title: SQL counting aggregate query
body: <p>I have the following query:</p>
  
  <pre><code>select prop_id
      , sum(amount)bnp_spent
      , (select count(*) from cost where cost_type = 'Direct Cost')direct
      , (select count(*) from cost where cost_type = 'Burden Cost')burden
  from cost                                     
  group by prop_id
  </code></pre>
  
  <p>The subqueries are NOT WHAT I WANT. By selecting from the cost table I get the total number of costs that are Direct or Burden for all props</p>
  
  <p>What I want is the count of direct and burden costs for each prop_id</p>
  
  <p>Any help is greatly appreciated.</p>