Archive for June 3rd, 2009
From Stack Overflow:
I need to select 3 columns from a table, but I need each value from any column to be unique in the resultset for this column.
This query:SELECT DISTINCT TOP 10 a, b, c FROM x
will return 10 distinct sets.
How do I do it?
Here we will need to make sure that for each column in a record we are going to return, no previous record returned so far does not contain the same value of the column.
Let’s create a sample table and construct the query:
Read the rest of this entry »