Is it possible to extract a data in one query?
table
id | user_id | punch_in | punch_out |
1 1 07:00 08:00
2 1 09:00 10:00
3 2 07:00 08:30
4 2 09:00 10:00
get a user id where time between a previous punch_out and next punch in is one hour (user 1)
9-8 = 1.
Is it possible to do it in one query or I need to use some additional table to make calculations?