Solution:
SELECT t1.LogID, t1.inserteddate, ISNULL(DATEDIFF(s, x.inserteddate, t1.inserteddate), 0) AS Time_Diff_Secs FROM [dbo].[tbl_name_here] t1 OUTER APPLY ( SELECT TOP 1 inserteddate FROM [dbo].[tbl_name_here] t2 WHERE t2.LogID < t1.LogID ORDER BY t2.LogID DESC) x where t1.actionname like '%Copy%' and t1.inserteddate > getdate() -7
Image 1:
|
|
|
|
|