Suppose we have the following data set.
ID C1 C2
1 - a - a
2 - b - b
3 - a - a
4 - a - b
5 - a - b
6 - b - b
I can execute the following statement:
select C1, C2 from Hazaa
group by C1, C2
However, I'd like to be able to get the value from ID column as well. Of course, I understand it's not possible just like that. My condition is that it's the lowest ID value in each groupings members that is listed.
I've tried googling for that but I think I'm expressing my request in a clumsy way because Google gives me nada, at least as far I can understand. The best hit is this one but, frankly, I'm not sure I understand how it's done. (I need it to work on 2005 but in the future we'll move to 2012 so if there's a neater trick there, I'd like to learn both ways.)