laserdream

Non-unique rows in SQL

March 30, 2009 · Leave a Comment

I always forget how to do this for no apparent reason:

SELECT row1, row2, count(*) AS instances FROM table GROUP BY row1, row2 HAVING count(*) > 1;

The sad part is that I do it on a pretty frequent basis…

Categories: Uncategorized

0 responses so far ↓

  • There are no comments yet...Kick things off by filling out the form below.

Leave a Comment