This is an automated archive.

The original was posted on /r/mysql by /u/PM_SOMETHING_NICE3 on 2023-08-11 21:35:06+00:00.


Lets say I have three tables; matches, teams and players, and I want to select all matches where ronaldo or messi has played and then get these matches including all teams and players data not just ronaldo and messi, how do I do that?

I tried:

select *
    from
    matches m
        inner join
    teams t
        on t.matches_matchId = m.matchId
        inner join 
    participants p
        on p.matches_matchId = m.matchId
  where p.name = 'ronaldo' or p.name = 'messi';

and that returns only messi and ronaldo participants not all players, how do I return all players in those matches but still limit the matches to the ones where messi and ronaldo played.