Get Unique Results in a query.

Posted by Bathan on Stack Overflow See other posts from Stack Overflow or by Bathan
Published on 2010-04-29T19:41:58Z Indexed on 2010/04/29 19:47 UTC
Read the original article Hit count: 315

Filed under:

Hi guys! Im sure this will be pretty simple for a t-sql guru.

I have the following result from a table

idMain IdSecondary TextValue
1,1,text1
1,2,text2
2,5,text3
2,6,text5

And I want to obtain the first occurence of the idMain only.

THe result should be like this.

idMain,idSecondary,TextValue 1,1,text1 2,5,text3

How can I achieve this?

© Stack Overflow or respective owner

Related posts about tsql