Trying to find duplicate values in TWO rows and TWO columns - SQL Server

Viewed 90

Using SQL Server, I'm not a DBA but I can write some general SQL. Been pulling my hair out for about an hour now. Searching I've found several solutions but they all fail due to how GROUP BY works.

I have a table with two columns that I'm trying to check for duplicates:

  • userid
  • orderdate

I'm looking for rows that have BOTH userid and orderdate as duplicates. I want to display these rows.

If I use group by, I can't pull any other data, such as the order ID, because it's not in the group by clause.

4 Answers
Related