Skip to content

Instantly share code, notes, and snippets.

@mikehins
Created March 8, 2023 22:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikehins/472bc7897a588b254183cca189437e3f to your computer and use it in GitHub Desktop.
Save mikehins/472bc7897a588b254183cca189437e3f to your computer and use it in GitHub Desktop.
SELECT t.my_column_1, t.my_column_2
FROM (
SELECT *,
ROW_NUMBER() OVER (PARTITION BY my_column ORDER BY my_column_2 DESC) AS row_num
FROM my_table
) t
WHERE t.row_num = 1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment