Skip to content

Instantly share code, notes, and snippets.

@neumachen
Forked from ramiroaznar/query.sql
Created October 29, 2018 15:50
Show Gist options
  • Select an option

  • Save neumachen/d4bb3a3f39a6aa65358e0dff6b7d0923 to your computer and use it in GitHub Desktop.

Select an option

Save neumachen/d4bb3a3f39a6aa65358e0dff6b7d0923 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