I've been presented with a task to do a query similar to the following
and I was curious as to what the quickest query would look like.
Anyone have any ideas??
Some_Id Value
1 A
1 B
1 C
2 C
2 A
2 B
3 B
3 C
4 C
5 Q
5 C
5 R
6 T
7 P
7 B
The problem is that I want to select one record for each ID. If a
record with the value of 'A' exists, then I want to select that record
for that ID. If not, I want to select the record with the value 'B'
for that ID if it exists. Otherwise, just give me the first record for
that ID that exists. The result set would look like this:
Some_ID Value
1 A
2 A
3 B
4 C
5 Q
6 T
7 B
Thanks for your input!