prova qualcosa del genere:
select *, DATEDIFF(minute, (
select max(b.TimeOut)
from TIMESHEET as b where a.EmpID=b.EmpID and b.ROW<a.ROW
), a.TimeIn
) as diff
from TIMESHEET as a
prova qualcosa del genere:
select *, DATEDIFF(minute, (
select max(b.TimeOut)
from TIMESHEET as b where a.EmpID=b.EmpID and b.ROW<a.ROW
), a.TimeIn
) as diff
from TIMESHEET as a