Skip to content
Advertisement

I have multiple entry and exit status of a person. how do i get the last status of single person

I have a table in sql in following format

Output required

Advertisement

Answer

In_Time should be the first instead of the last status.

Then your result should be instead

Userid IN_TIME OUT_TIME

Code like below, live demo here

Updated

If you want to get the last status for In_Time, just adjust slightly condition from Min to Max like below, live demo here

Output

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement