Skip to content

Instantly share code, notes, and snippets.

@jamesasu
Created August 18, 2020 00:08
Show Gist options
  • Save jamesasu/ffba1da6de0b363e230a5209d16899d8 to your computer and use it in GitHub Desktop.
Save jamesasu/ffba1da6de0b363e230a5209d16899d8 to your computer and use it in GitHub Desktop.
Use window functions to remove duplicate rows
-- Use window functions to remove duplicate rows:
SELECT * EXCEPT(row_number)
FROM (
SELECT
Email,
ROW_NUMBER() OVER (PARTITION BY Email) row_number
FROM Dataset.Emails
)
WHERE row_number = 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment