title: using sql count in a case statement
body: <p>I have a table and i need to present the output in the following fashion.</p>
  
  <pre><code>tb_a:
  
  col1  |  reg_id | rsp_ind 
  </code></pre>
  
  <p>Count of rows with rsp_ind = 0 as 'New' and 1 as 'Accepted'</p>
  
  <p>The output should be </p>
  
  <pre><code>NEW | Accepted
  9   | 10
  </code></pre>
  
  <p>I tried using the following query.</p>
  
  <pre><code>select 
    case when rsp_ind = 0 then count(reg_id)end as 'New',
    case when rsp_ind = 1 then count(reg_id)end as 'Accepted'
  from tb_a
  </code></pre>
  
  <p>and i m getting output as </p>
  
  <pre><code>NEW | Accepted
  NULL| 10
  9   | NULL
  </code></pre>
  
  <p>Could someone help to me tweak the query to achieve the output.
  Note : I cannot add a sum surrounding this. Its part of a bigger program and so i cannot add a super-query to this.</p>