title: Getting matching records from mysql query
body: <p>I have database table with the following structure, that is used to match people at a dating event:</p>
  
  <pre><code>ID | EVENT | USERS_ID | MATCH_ID | GENDER
  1 | 27 | 54 | 1245 | Female
  2 | 27 | 54 | 21 | Female
  3 | 27 | 21 | 45 | Male
  4 | 27 | 21 | 54 | Male
  </code></pre>
  
  <p>I am trying to write my query that will give me my matches.
  For example, from the data above, user 54 matches user 21 because 54 picked 21 and 21 picked 54.</p>
  
  <p>I need to pass as an input a USER_ID and the EVENT and get a list of the MATCH_ID that match that user.
  So, </p>
  
  <pre><code>SELECT match_id FROM……. WHERE users_id = 54 AND event = 27
  </code></pre>
  
  <p>I also need to know which users DIDN’T get any matches. This would be a separate query. From the example above, user 45 had no mutual matches.</p>
  
  <p>I’ve been fighting with this one for a while. Any ideas on this would be great.</p>
  
  <p>Thanks.</p>