Skip to content
Advertisement

How can I select multiple columns while setting one of them as DISTINCT

I have 6 columns and I want to select data from them while fixing one column as distinct

the Display should be the following:

Advertisement

Answer

Using ROW_NUMBER and TOP:

But this assumes that the second and third column are part of what defines a “group” in your expected result set. If instead only Column1 decides that, then use this version:

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