title: Trying to correct MySQL query to return desired result w/ joined table
body: <p>I'm working on a vehicle search resource.  Based on our current query, MySQL is returning the correct results.  However, the results are not what I'm looking for.  I know there's a mistake in the query, but not sure how to rectify it.</p>
  
  <p>Here are the tables:</p>
  
  <p><strong>vehicles table</strong></p>
  
  <pre><code>+----+--------+--------------+---------------------+---------------------+
  | id | active |    label     |     created_at      |     updated_at      |
  +----+--------+--------------+---------------------+---------------------+
  |  1 |      1 | test vehicle | 2016-03-14 15:34:00 | 2016-03-14 15:34:00 |
  +----+--------+--------------+---------------------+---------------------+
  </code></pre>
  
  <p><strong>vehicles_metas table</strong></p>
  
  <pre><code>+----+--------+------------+------------+------------------+---------------------+---------------------+
  | id | active | vehicle_id |  meta_key  |    meta_value    |     created_at      |     updated_at      |
  +----+--------+------------+------------+------------------+---------------------+---------------------+
  |  1 |      1 |          1 | type       | Performance Boat | 2016-03-14 15:36:00 | 2016-03-14 15:36:00 |
  |  2 |      1 |          1 | make       | Deep Impact      | 2016-03-14 15:36:00 | 2016-03-14 15:36:00 |
  |  3 |      1 |          1 | model      | Cuddy Cabin      | 2016-03-14 15:36:00 | 2016-03-14 15:36:00 |
  |  4 |      1 |          1 | year       | 2014             | 2016-03-14 15:36:00 | 2016-03-14 15:36:00 |
  |  5 |      1 |          1 | length     | 39               | 2016-03-14 15:36:00 | 2016-03-14 15:36:00 |
  |  6 |      1 |          1 | propulsion | (4) Mercury 350  | 2016-03-14 15:36:00 | 2016-03-14 15:36:00 |
  |  7 |      1 |          1 | hull       | fiberglass       | 2016-03-14 15:36:00 | 2016-03-14 15:36:00 |
  |  8 |      1 |          1 | price      | 399000           | 2016-03-14 15:36:00 | 2016-03-14 15:36:00 |
  +----+--------+------------+------------+------------------+---------------------+---------------------+
  </code></pre>
  
  <p><strong>current mysql query</strong></p>
  
  <pre><code>select `vehicles`.`id` from `vehicles` inner join `vehicle_metas` on `vehicle_metas`.`vehicle_id` = `vehicles`.`id` where (`vehicle_metas`.`meta_key` = 'type' and `vehicle_metas`.`meta_value` LIKE '%perf%') and (`vehicle_metas`.`meta_key` = 'model' and `vehicle_metas`.`meta_value` LIKE '%cuddy%')
  </code></pre>
  
  <p>As of right now, the query results in zero rows returned.  If I only use one of the two <code>meta_key &amp; meta_value</code> query filters, the record <code>vehicle_id: 1</code> is returned.</p>
  
  <p>I'm simply trying to return the vehicle ID that matches all <code>meta</code> query filters.  </p>