Skip to content

Instantly share code, notes, and snippets.

@softMaina
Forked from ramiroaznar/query.sql
Created October 24, 2020 18:53
Show Gist options
  • Save softMaina/6e2312e9c5108590952e8018d53b51c7 to your computer and use it in GitHub Desktop.
Save softMaina/6e2312e9c5108590952e8018d53b51c7 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