<p>I have a query where i have a date column (time) which tells about "IN" &amp; "OUT" timing of the people attendance by this single column</p>

<p>My queries are :-</p>

<p>1) How to get the daily attendance of each employee
2) How to come to know if the employee is present less than 5 hours</p>

<p>Please let me know the queries in SQL server.</p>

```
```
select 
      datediff(minute, TimeFrom, TimeTo) as AttendedTimeInMinutes,
      case when datediff(minute, sTimeFrom, sTimeTo) < 5 * 60 
         then 
          'less than 5 hours' 
         else '5 hours or more' 
      end
   from YourTable
```
```