I have an SQL table that stores the IN and OUT timestamps of each employee.
There are employees who punch the card more than once ( because they donβt hear that the card was read ), other employees who punch the card for any reason (maybe they meet a friend and continue talking for 1 or 2 minutes) they wait a few minutes before they hit again to get to the turnstile.
An example of SQL table data looks like this (only for 3 employees):

Now I would like to classify each time to find out which timestamp is correct, etc.
For instance:

EMP_01 ( ) LAST_LEAVE 00:38:21, , , LAST_LEAVE 00:38:16.
EMP_04 , 4 , 3 IN , , , , , , , , 1 .
, , ? ""?
UPDATE
EMP_04 3 (IN OUT), :
- 9:04:27 am (IN)
- 9:04:35 am (IN)
- 9:04:40 am (IN)
120 , 9:04:27 , , 120 .
, , EMP_04 :
- 9:04:27 am (IN)
- 9:04:35 am (IN)
- 9:08:10 am (IN)
, , 9:04:35. 9: 04.35 9:08:10 2 .