title: MySQL adding more than one WHERE with sub-select query
body: <p>This code gives me a nice result.  But I want to add in some fields from another table, I'm not sure where to put the additioanal WHERE code...</p>
  
  <pre><code>select day, sum(diff) as total_diff
  from (
  select sub_meterID, date(`date`) as day, max(value) - min(value) as diff
  from `sub_meter_data`
  where date(`date`) &gt; '2012-10-01'
     and sub_meterID in ('58984','58985','58986','58987')
  group by sub_meterID, date(`date`)
  ) a
  group by day
  </code></pre>
  
  <p>The additional fields I need to match up are:</p>
  
  <pre><code>othertable.meterID = sub_meter_data.sub_meterID
  
  moretable.meterID = othertableID
  </code></pre>