Use row_number(). You can order it by whatever you want, in a sub-query, then filter the way you want in the outer query.
Like this:
;with CTE as
(select GroupNumber, SubGroup,
row_number() over (partition by GroupNumber order by SubGroup) as Row
from dbo.MyTable)
select GroupNumber, SubGroup
from CTE
where Row = 1;
Min() would probaby be more efficient, but you already said you can't use that in this case, so this method will probably be your best bet.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon