Skip to content
Advertisement

SQL select duplicate rows based on multiple columns

I have created a request that returns me IDs of rows having the same column value. For example :

I’d like to get this kind of result :

The best result I got so far is :

But as you can see, I have duplicate values across the first two columns

…Right now, without using cursors, I’m stuck.

I am on SQL Server 2008.

Thanks for your help

Advertisement

Answer

Use a derived table to get your base values and join it back to the original table.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement