Skip to content

Instantly share code, notes, and snippets.

@anhnguyenkim-agilityio
Forked from ramiroaznar/query.sql
Created December 24, 2019 07:43
Show Gist options
  • Save anhnguyenkim-agilityio/25a76215983e07a3b5d8cc2f8146f234 to your computer and use it in GitHub Desktop.
Save anhnguyenkim-agilityio/25a76215983e07a3b5d8cc2f8146f234 to your computer and use it in GitHub Desktop.
How to find duplicate values with PostgreSQL
select * from table t1
where (select count(*) from table t2
where t1.field = t2.field) > 1
order by field
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment