title: mySQL SELECT using a foreign key in another table
body: <p>I'm having a hard time finding this answer so I'm hoping you guy can help me out.</p>
  
  <p>I have two tables: </p>
  
  <p><strong>event_list</strong> with columns 'id', 'name', 'date' and <strong>event_default</strong> with one column 'default_id' which is a foreign key event_list('id')</p>
  
  <p>The idea is that only one event can be default at a time, hence why event_default can only have one value (the id of the event in event_list).</p>
  
  <p>I need a SELECT statement that obtains the event_list data of the event that is currently default. But I want to do this in one SELECT statement which I think I can do rather then two. I am using the PDO framework if that helps.</p>
  
  <p>Success! Thank you. I ended up using:</p>
  
  <pre><code>$this-&gt;connection-&gt;query('SELECT * FROM event_list el JOIN event_default ef ON el.id = ef.default_id');
  </code></pre>