title: Pulling in relational database fields
body: <p>So here's my problem. I have three tables:</p>
  
  <p>Person Table</p>
  
  <p><code>person_id, name</code></p>
  
  <p>Events Table</p>
  
  <p><code>event_id, event_name, event_date</code></p>
  
  <p>Matches Table</p>
  
  <p><code>match_id, person_a, person_b, winner, event</code></p>
  
  <p>So in the matches table, person_a, person_b, and winner are integers that correspond to person_id in the Person table.  </p>
  
  <p>If I pull in a row from Matches table, it would come out like this:</p>
  
  <p><code>1, 1, 2, 1, Chess Tournament #33</code></p>
  
  <p>How can I lookup those 3 fields (person_a, person_b, and winner) with the Person table to pull in their actual names so that the result is?</p>
  
  <p><code>1, John, Steven, John, Chess Tournament #33</code></p>
  
  <p>I looked into joining the two tables, but it doesn't makes sense because I can't just do ON id=id, or WHERE id=id. I appreciate any help.</p>