I am working on a query for a project and sometimes the results have multiple rows for the same entity. What I need to do is:
If the results look like this:
Type | Entity ----------------------------- TypeA | B. Didly TypeA | J. Hendrix TypeC | G. VanFleet TypeA | M. Manson TypeB | M. Manson TypeC | M. Manson Then I need to choose TypeB over TypeA or TypeC for M. Manson
My results need to look like this:
Type | Entity ----------------------------- TypeA | B. Didly TypeA | J. Hendrix TypeC | G. VanFleet TypeB | M. Manson I am struggling with using a cursor or finding another option.
Basically if an entity has all three types, I need to only get TypeB for that entity.
There are 10 possible "types" from what I have been told. And the client has given me their ranking of those types. I am thinking a case statement to set the rank.
AandC. Does one of those win? Do you not care?