I have this table:
UNIQUE_ID | WINNER_ID | FINALIST_ID
________1 | ________1 | __________2
________2 | ________1 | __________3
________3 | ________3 | __________1
________4 | ________1 | __________2
And I need a list of all players (Winners and Finalists) and a COUNT of how many times they have got 1st or 2nd place.
In this case it would be:
PLAYER_ID | WINNER_TIMES | FINALIST_TIMES
________1 | ___________3 | _____________1
________2 | ___________0 | _____________2
________3 | ___________1 | _____________1
A similar question was already asked here (LINK), but I didn’t understand the answer.
Live example at SQL Fiddle.