Skip to content

Instantly share code, notes, and snippets.

@ryantuck
Created July 28, 2016 14:58
Show Gist options
  • Save ryantuck/33022660f2fc51f8591272e226cf82bb to your computer and use it in GitHub Desktop.
Save ryantuck/33022660f2fc51f8591272e226cf82bb to your computer and use it in GitHub Desktop.
some helpful sql tricks

find any rows where multiple ids exist:

select
  *
from
  my_table
where
  id in (
    select
      id
    from
      my_table
    group by id
    having count(*) > 1
  )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment