title: How to make query in junction table in a many-to-many scenario where you want to regroup
body: <p>I'm struggling to find a proper solution for the following problem:</p>
  
  <p>I have a table for matches, that represent a game match, a match is always composed of 5 players. I have a table for players, each row is a player, representing a real person. I have a junction table between the two as they behave in a Many-To-Many pattern. match_player link the concept of a specific match to a player.</p>
  
  <p>Now I need help building a SQL query. Given that I know the identity of 5 specific players, I would like to list all matches where those 5 players played together.</p>
  
  <p>Can you help?</p>
  
  <p>Some reference to help visualize:</p>
  
  <pre><code>table: player
    - id
  
  table: match
    - id
  
  table: match_player:
    - id
    - player_id
    - match_id
  </code></pre>
  
  <p>Considering I have players with id (1, 5, 9, 11 and 23), I would like to know all the matches they played together.</p>
  
  <p>I can easily get it to work by retrieving everything then iterating on the data, but ideally I would like to not have to do post-processing, hopefully a query can do it.</p>