If you have a table which holds history (updates, deletes) from another table, how would you pull an associated update row if it comes after a delete operation?
Table has the following columns not related to the data
ID int, -- Identity
OP varchar -- the delete or update operation coded as 'D' or 'U'
Removed_Date -- the date the row was removed from the 'Live' table
I've tried something like this
Select *
from historytable as table1
join historytable as table2 on table1.Removed_Date like table2.Removed_Date
which results in multiple rows (ten or more) of duplicates for one row in the table.