Skip to content

Instantly share code, notes, and snippets.

@Mr--John-Doe
Last active December 22, 2021 09:39
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 Mr--John-Doe/ef1c1bb8315554f66e72303b482d75ba to your computer and use it in GitHub Desktop.
Save Mr--John-Doe/ef1c1bb8315554f66e72303b482d75ba to your computer and use it in GitHub Desktop.
Filter the last row of a query
SELECT *
, ROW_NUMBER() OVER (PARTITION BY client ORDER BY sale_date DESC) AS rownum_desc
FROM sales_table
QUALIFY rownum_desc = 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment