title: Subtract two subqueries
body: <p>I have the following queries. I'd like to subtract the numbers from the SUMs and then return only the ones with a result other than 0. Any help would be appreciated. I would also be interested to see if this can be done in one query. I tried it with the HAVING clause but it was returning wrong results. Using SQL Server 2008</p>
  
  <pre><code>  SELECT 
  (
   SELECT station_id, SUM(tcl_missing + tcl_not_missing) as tcl_total
   FROM tcl_missing_summary 
   GROUP BY station_id
  ) as a 
  
  (
   SELECT station_id, SUM(total) as total
   FROM tcl_breakdown_op
   WHERE tr_standard not like '%cru'
   GROUP BY station_id
  ) as b
   WHERE a.tcl_total - total &lt;&gt; 0
  </code></pre>