I'm trying to see how many times a player has lost a match at any of his favourite stadiums. I've tried the following, but it is not returning the correct values:
select players.name,
count (case when players.team <> matches.winner and favstadiums.stadium = matches.stadium then 1 else null end) as LOSSES
from players
join favstadiums
on favstadiums.player = players.name
join matches
on favstadiums.stadium = matches.stadium
group by players.name;
I've also tried left/right joins, but it makes no difference in the output.
Here is the relational diagram of the database for reference:

Any ideas?