Created
December 24, 2021 07:10
-
-
Save jazz7381/e35af430f0685ca15d73d3b389ce2a84 to your computer and use it in GitHub Desktop.
Get data all duplicate except the first data PostgreSQL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT * FROM tablename | |
WHERE id IN (SELECT id | |
FROM (SELECT id, | |
ROW_NUMBER() OVER (partition BY column1, column2 ORDER BY id) AS rnum | |
FROM tablename) t | |
WHERE t.rnum > 1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment