SQL Server find datediff between different rows, sum

后端 未结 2 917
南方客
南方客 2021-01-24 16:59

I am trying to build a query that analyzes data in our time tracking system. Every time a user swipes in or out, it makes a row recording the swipe time and On or Off site (entr

2条回答
  •  余生分开走
    2021-01-24 17:16

    First you need to talk with the business side and decide on a set of matching rules.

    After that I suggest that you add a status field to the table where you record the status of each row (matched, unmatched, deleted etc). Whenever a row is added you should try to match it to make a pair. A successful match sets the status of both rows to matched, otherwise the new row will be unmatched.

提交回复
热议问题