I\'m stuck. I\'ve looked for an answer, but can\'t seem to find subtracting time in the same table from two different rows of the same table that fits. I\'m having a difficu
WITH rows AS
(
SELECT *, ROW_NUMBER() OVER (ORDER BY EmpID) AS rn
FROM TimeSheet
)
SELECT mc.EmpID, DATEDIFF(MINUTE, mc.TimeIn, mp.TimeOut) as TimeDiffInMinutes
FROM rows mc JOIN rows mp ON mc.rn = mp.rn-1