SSMS
 sql >> Database >  >> Database Tools >> SSMS

Trova la differenza di tempo tra due righe consecutive nella stessa tabella in sql

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