Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

select id from tracks qualify row_number() over partition by (album_id order by milliseconds desc) =1

That should work

Look I’m a diehard SQL just use it guy but open to improvements. But I’m loathe to use abstractions for things when the underlying thing is so expressive.

Autocomplete of fields in a good editor, schema help, etc go a long way to making SQL being written raw very nice.



QUALIFY is not part of the SQL standard.


I'm pretty sure QUALIFY was added in SQL 2023. Maybe it was only discussed and didn't make it.


I don't know, and I don't feel like paying $200 per chapter to find out.


more importantly you can run prql on Postgres today, but can't use qualify yet


Then a subselect with the window function and an outer where clause where the window function column = 1




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: