I have a table GAMES with this information:
- Id_Game (int)
- Id_Referee1 (int)
- Id_Referee2 (int)
These are some rows:
ID_GAME ID_REFEREE1 ID_REFEREE2
1 1000 728
2 1004 813
3 728 1004
4 1004 1000
I want to have a list with the number of games that a referee has officiated, doesn't matter if as a Referee1 or Referee2. In this case, I would like to receive this list order by number of games DESC.
REFEREE NUMBER OF GAMES
1004 3
728 2
1000 2
813 1
Which would be the SQL query? I have no idea of how to join fields Id_Referee1 and Id_Referee2...
THANKS