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

Window function is your friend.

Row_number() over (partition by x order by) as rank

Then: where rank = 1.

Grouping is unordered, which is a clean definition.



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

Search: