I have table like this:
a b
1 23
1 2
1 7
2 9
2 11
I want to select the first row(orde
select a,b
from (
select a,b,row_number() over(partition by a order by b desc) as roworder
from myTable
) temp
where roworder = 1
see http://msdn.microsoft.com/en-us/library/ms186734.aspx
If as you indicated, order doesn't matter, any aggregate function on b
would be sufficient.
SELECT a, b = MIN(b)
FROM YourTable
GROUP BY
a