Skip to content
Advertisement

Query with Group and name sorting

I am trying to build a SQL query that is bit more complicated to what I am used to writing.

Example data:

So far I have a working query

Currently it will return

But I would like that query to always returns the names with biggest event_id, so good results would be “[Lpr] abc” and “[Lpr] Name B”.

Advertisement

Answer

I think so

or you can use the window function win function sum

Sorry for the mistake 🙂

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