How to find the dates difference in minutes among different columns levels as
No SourceID RecordID Start Date End Date 1 1 1 20
SELECT SourceId, RecordId, StartDate, EndDate, DATEDIFF(mi,a.EndDate,b.StartDate) DiffMin FROM table a LEFT JOIN table b ON A.no = B.no-1
SELECT SourceId,RecordId,StartDate,EndDate , DATEDIFF(mi,a.EndDate,b.StartDate) DiffMin FROM table a LEFT JOIN table b ON A.no = B.no+1