**Number of Registered Nonprofit Organizations by State, 2012**

SELECT '**United States**' AS State,
SUM(x.Total__Number_of__Nonprofit__Organizations) AS Total__Number_of__Nonprofit__Organizations,
SUM(x.`Number_of__501(c)(3)^{1}__Nonprofit__Organizations`) AS `Number_of__501(c)(3)^{1}__Nonprofit__Organizations`,
SUM(x.Number_of__Other__Nonprofit__Organizations) AS Number_of__Other__Nonprofit__Organizations,
round(SUM(y.POP2012est)/1,0) as Estimated__2012__Population,
round(10000*SUM(x.Total__Number_of__Nonprofit__Organizations)/SUM(y.POP2012est),1) as `Total__Nonprofits__per_10,000__Persons`,
round(10000*SUM(x.`Number_of__501(c)(3)^{1}__Nonprofit__Organizations`)/SUM(y.POP2012est),1) as `501(c)(3)^{1}__Nonprofits__per_10,000__Persons`,
round(10000*SUM(x.Number_of__Other__Nonprofit__Organizations)/SUM(y.POP2012est),1) as `Other__Nonprofits__per_10,000__Persons`
FROM (SELECT z.State, count(*) as Total__Number_of__Nonprofit__Organizations,
count(IF(IFNULL(z.SUBSECCD,'00')='03',1,NULL)) as `Number_of__501(c)(3)^{1}__Nonprofit__Organizations`, count(IF(IFNULL(z.SUBSECCD,'00')<>'03',1,NULL)) as Number_of__Other__Nonprofit__Organizations
FROM bmf.bm1406 z GROUP BY z.State) x LEFT JOIN lookup.statepop2 y on x.State=y.State WHERE y.State IS NOT NULL GROUP BY State
UNION SELECT x.State, x.Total__Number_of__Nonprofit__Organizations, x.`Number_of__501(c)(3)^{1}__Nonprofit__Organizations`, x.Number_of__Other__Nonprofit__Organizations,
round(y.POP2012est/1,0) as Estimated__2012__Population,
round(10000*x.Total__Number_of__Nonprofit__Organizations/y.POP2012est,1) as `Total__Nonprofits__per_10,000__Persons`,
round(10000*x.`Number_of__501(c)(3)^{1}__Nonprofit__Organizations`/y.POP2012est,1) as `501(c)(3)^{1}__Nonprofits__per_10,000__Persons`,
round(10000*x.Number_of__Other__Nonprofit__Organizations/y.POP2012est,1) as `Other__Nonprofits__per_10,000__Persons`
FROM (SELECT z.State, count(*) as Total__Number_of__Nonprofit__Organizations,
count(IF(IFNULL(z.SUBSECCD,'00')='03',1,NULL)) as `Number_of__501(c)(3)^{1}__Nonprofit__Organizations`, count(IF(IFNULL(z.SUBSECCD,'00')<>'03',1,NULL)) as Number_of__Other__Nonprofit__Organizations
FROM bmf.bm1406 z GROUP BY z.State) x LEFT JOIN lookup.statepop2 y on x.State=y.State WHERE y.State IS NOT NULL GROUP BY x.State

Notes:

^{1}501(c)(3) includes both public charities and private foundations.