I want to write a query like this:
For a table that has these columns: ColA ColB ColC, ColD
select first (ColA, ColB, ColC, ColD) (ColB, ColC) from the table order from ColD
The query must order a table by ColD, and then group the results by combinations of ColB and ColC (they can have different data types) and returns the first rows (with all columns of the table) in groups.
How is this possible in MS SQL Server 2005?
homam source
share