Home Forums SQL Server 2008 T-SQL (SS2K8) Obtaining earliest change for one colum? RE: Obtaining earliest change for one colum?
natevdh@gmail.com
Valued Member
Points: 69
More actions
April 11, 2013 at 12:05 pm
#1605713
You were on the right track with the self join
SELECT t1.ActionDate, t1.Field_B
FROM #test t1
LEFT JOIN #test t2 ON t1.Audit_ID = t2.Audit_ID-1
WHERE t1.Field_B != t2.Field_B OR t2.Audit_ID IS NULL