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?
You should be able to join with a sub query, as in the following example. This assumes that by “first” you mean the lowest
idSecondary: