Owned by david, visibility: Public
select case when latest_income > 10000000 then '11 over-10m' when latest_income > 5000000 then '10 5m-to-10m' when latest_income > 1000000 then '09 1m-to-5m' when latest_income > 500000 then '08 500k-to-1m' when latest_income > 250000 then '07 250k-to-500k' when latest_income > 100000 then '06 100k-to-250k' when latest_income > 50000 then '05 50k-to-100k' when latest_income > 25000 then '04 25k-to-50k' when latest_income > 10000 then '03 10k-to-25k' when latest_income > 0 then '02 under-10k' when latest_income = 0 then '01 zero-income' else '00 unknown' end as "Income band", sum(case when charity_type = 'Charitable company' then 1 else 0 end) as "Charitable company", sum(case when charity_type = 'CIO' then 1 else 0 end) as "CIO", sum(case when charity_type = 'Trust' then 1 else 0 end) as "Trust", sum(case when charity_type = 'CIO' then 0 when charity_type = 'Charitable company' then 0 when charity_type = 'Trust' then 0 else 1 end) as "Others", to_char((sum(case when charity_type = 'Charitable company' then 1 else 0 end) / count(*)::float)*100, 'FM99D9%%') as "Charitable company (proportion)", count(*) as total from charity_ccewcharity cc where charity_registration_status = 'Registered' and linked_charity_number = 0 group by "Income band"
12 rows
Duration: 194.43ms