Thursday, May 12, 2011

Crosstab based total calculation

select
           
    dist_code,
           
    sum(case when scheme = 'I' then 1 else 0 end) as ICDS,
           
     sum(case when scheme = 'N' then 1 else 0 end) as NMP
from
       
         m_ddo
group by
           
    dist_code
order by
           
    dist_code

  

No comments:

Post a Comment