title: mysql update with 2 columns in where clause subquery
body: <p>In the table below, I need to update column brake_pad, as follows:</p>
  
  <pre><code>Table ct_maint(simplified). 
  Primary key is the combined model_id/fuel columns.
  
  model_id    fuel    brake_pad
     1        gas         0
     1        diesel      0
     2        gas         0
     3        diesel      0
     4        gas         0
     4        diesel      0
     5        diesel      0
     6        gas         0
     6        diesel      0  
     ......
  </code></pre>
  
  <p>The query that tells me which brake_pad to update is:</p>
  
  <pre><code>SELECT models.model_id, motors.fuel FROM models
  INNER JOIN versions USING(model_id)
  INNER JOIN versiontrim USING(version_id)
  INNER JOIN motors USING(motor_id)
  WHERE trim_id IN(502, 506)
  GROUP BY model_id, fuel
  </code></pre>
  
  <p>This query gives a result set like:</p>
  
  <pre><code>model_id      fuel
     1          diesel
     3          diesel
     4          gas
     4          diesel
     6          gas
  </code></pre>
  
  <p>So, I was going like,</p>
  
  <pre><code>UPDATE ct_maint SET brake_pad=1000 WHERE model_id AND fuel IN( SELECT.....)
  </code></pre>
  
  <p>but stopped long before mysql buzzed me.</p>
  
  <p>Any help is appreciated.</p>