How to select all columns where a set of them are distinct in SQL Server 2008 r2 -


I have a bunch of columns in a SQL table and I want to include each field in that table in a temporary table Where a set column is different In other words, I have a table with A, B, C, D, E, F, and G. How can I select each row where A, B and C are different? Looking at the comments on Gordon's response, I believe this should work for you:

 * from table A, B, C , Count (*) = 1), select one, B, C, Count (*) from the table group. A and main.b = sub.b and main.c = sub.c  

Comments