I want to select the total number of appearance of a single player in two other tables.
Here is my database structure (postgres):
Table: Player
id integer
Table: World Champions
id integer
year date
player_id integer
Table: European Champions
id integer
year date
player_id integer
The id on table player is also available in table "World Champions" and "European Champions" (player_id). I want to select the data as following:
player.id worldChampionTitles europeanChampionTitles
1 3 4
2 1 0
3 0 0
4 1 1
But I have no Idea how to write my select query for that.