title: MySQL: Multiple ids in one row from another table
body: <p>This may be a bit convoluted but I'll give it a shot.</p>
  
  <p>I have a table that has event data:</p>
  
  <pre><code>| id | event | from_location | to_location |
  |  1 |  move |            12 |          14 |
  |  2 |  move |            13 |          15 |
  </code></pre>
  
  <p>and the from location and to location are ids referenced in  another able</p>
  
  <pre><code>| id | name    |
  | 12 | london  |
  | 13 | paris   |
  | 14 | newyork |
  | 15 | tokyo   |
  </code></pre>
  
  <p>My issue is I need to search both the first table based on the location, but using the name in the second, and I'd like to do it as simply as possible with one query. </p>
  
  <p>If it was one column, I could just do a join and have the name available but since it is two, this doesn't work.</p>
  
  <p>I could search for the name in the first table, then having the id, use that to search the other table - but I'd like to do it in one query.</p>
  
  <p>So my question - is there a way to simply replace the ids with the corresponding name - then do the search, all in one query?</p>
  
  <p>I would say one more thing - I didn't set this up. if I had, I'd have forgone the use of ids altogether and simply used the names as the keys. But now that it is how it is - lets assume I can't change this.</p>
  
  <p>Thanks</p>