You did not provide enough details about your issue, especially about
In
and
Out
entries... Do they can exceed a day?
If
In-Out
entries do not exceeed a day, you have to create a pair of
In-Out
entries for each user per day. Then you have to calculate a time in minutes. You can use
DATEADD[
^] function to achieve that:
DATEDIFF(n, OutTime, InTime)
Finally, you have to sum total time per user.
EmpID IN OUT StayTime(Minutes)
1001 2019-03-31 08:30:00 AM 2019-03-31 04:30:00 PM 480
1002 2019-03-31 08:30:00 AM 2019-03-31 03:45:00 PM 435