title: How to replace null into 0 in a complex query
body: <p>I would like to replace the total value to 0 when it is null</p>
  
  <p>Here is the query:</p>
  
  <pre><code>SELECT DISTINCT(location),  (
      SELECT  Count(a.location) as total
      FROM table_fo a   
      LEFT JOIN  table_info b ON a.TRADEID = b.TRADEID AND   a.asofdate = b.asofdate
      WHERE (b.TERMSTATUS &lt;&gt; 'TRAN' OR b.TERMSTATUS is NULL)  AND b.asofdate = '20110105' AND a.location = pfo.location
   GROUP BY a.LOCATION  
  )   AS total   
  FROM table_fo  pfo
  WHERE asofdate = '20110105';
  </code></pre>