Brief description or abstract:
select count(*) as count, sum(totrev), sum(exps), SUM( totrev-exps) as netinc, sum(fundbal) as net, avg(if(fundbal/exps * 100 <300, fundbal/exps * 100, null)) as avgNetAssets
from nccs.core2006pc where state in ('DC','MD','VA')
and substring(nteefinal,2,1) not in ('0','1');
select count(*) as count, sum(totrev), sum(exps), SUM( totrev-exps) as netinc, sum(fundbal) as net, avg(if(fundbal/exps * 100 <300, fundbal/exps * 100, null)) as avgNetAssets
from nccs.core2008pc
where state in ('DC','MD','VA')
and substring(nteefinal,2,1) not in ('0','1');
select count(*) as count, count(b.ein) as countAlive, sum(if( substring(ctaxper,1,4) >='2008' and cTotrev > 25000, 1,0)) as Filed990
from nccs.core2006pc a left join bmf.bm1008c3 b using (ein)
where a.state in ('DC','MD','VA')
and substring(a.nteefinal,2,1) not in ('0','1');
-- 4 years earlier
select count(*) as count, count(b.ein) as countAlive, sum(if( substring(ctaxper,1,4) >='2004' and cTotrev > 25000, 1,0)) as Filed990
from nccs.core2002pc a left join bmf.bm0605c3 b using (ein)
where a.state in ('DC','MD','VA')
and substring(a.nteefinal,2,1) not in ('0','1');
|