Created
September 10, 2021 00:22
-
-
Save AugustoCalaca/9f200be4387f5901e53d395ff34f2896 to your computer and use it in GitHub Desktop.
How to find duplicate text values with postgres
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 id, name from table t1 | |
where ( | |
select count(*) from table t2 | |
where regexp_replace(unaccent(trim(t1.name)), '\W+', '', 'g') ilike regexp_replace(unaccent(trim(t2.name)), '\W+', '', 'g') | |
) > 1 | |
order by name asc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment