Each time the record is updated it saves the following detail the first three fields info, now i want to know when was the record updated prior to this one: where i pass the first 3 values. which is I pass '168',12,'2012-OCT-25'prior to 25th OCT record was updated on 18th OCT 2012.that infomration i need to get, is it possible, i want to implement this logic within a loop and find out all looped data.Declare @Sample table (acct_unit varchar(10),OBJ_ID int, STAT_DATE datetime, STATUS_FLAG varchar(20), SUR_KEY Int)insert @Sampleselect '168',12,'2012-OCT-25', 1234 union allselect '168',12,'2012-OCT-18', 1118 union allselect '168',12,'2012-OCT-16', 1103 union allselect '168',12,'2012-OCT-12', 1090 union allselect '173',18,'2012-OCT-25', 1220 union allselect '173',18,'2012-OCT-18', 1214 union allselect '173',18,'2012-OCT-16', 1190 union allselect '173',18,'2012-OCT-12', 1145
Thanks a lot for the helpful info.