Skip to content
Advertisement

Get only list of user with latest update by days

I am struggling to write a query to display list of users that check-in in a day, but if the same user check-in twice or more, it would take the latest in a day. For example user A check-in in the morning, then check-in again in the evening, then the system will display only his latest check-in in the list of users that check-in in that day.

This is my table:

Then I would like to write a query that generate output like this:

Advertisement

Answer

You can use a correlated subquery:

Or you can use row_number():

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