Created
February 24, 2021 20:49
-
-
Save pikonha/e063d1cad12d994acba496af934a1a3f to your computer and use it in GitHub Desktop.
[POSTGRES] Remove duplicates and left the first register
This file contains 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
with uniq as ( | |
select distinct on (table.a, table.b) * | |
from table | |
) delete from table table1 where table1.id not in (select id from uniq) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment