Skip to content

Instantly share code, notes, and snippets.

@vlapenkov
Last active January 22, 2024 14:31
Show Gist options
  • Save vlapenkov/a09d980c45f8803a3973eb5b753659b7 to your computer and use it in GitHub Desktop.
Save vlapenkov/a09d980c45f8803a3973eb5b753659b7 to your computer and use it in GitHub Desktop.
Использование rank в выражении postgres
select carrier.id , cc.car_id , rank (*) over (partition by carrier_id ORDER BY cc.created DESC)
from carrier.carrier carrier join carrier.carrier_car cc on carrier.id = cc.carrier_id
order by carrier.id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment