Skip to content
Advertisement

Return the second newst record of a group sql

I have a table like the following:

how can I get this:

the result should be the second newest record of a coworker if there’s more than one, or the only present

Thanks for any help!

Advertisement

Answer

Try the following with window function row_number. Here is the demo.

Output:

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