Breakdown By Region By Country SELECT UCASE(B.name) as name, count(A.id) as total from %%AGILE_DB_PREFIX%%account A join %%AGILE_DB_PREFIX%%country B on (A.country_id=B.id) A.site_id = %%DEFAULT_SITE%% GROUP BY name ORDER BY total DESC 0 Country name Accounts total true SELECT B.name, count(A.id) as total from %%AGILE_DB_PREFIX%%account A join %%AGILE_DB_PREFIX%%country B on (A.country_id=B.id) A.site_id = %%DEFAULT_SITE%% GROUP BY name ORDER BY total DESC By Region SELECT UCASE(A.state) as state, UCASE(B.name) as country, count(A.id) as total from %%AGILE_DB_PREFIX%%account A join %%AGILE_DB_PREFIX%%country B on (A.country_id=B.id) A.site_id = %%DEFAULT_SITE%% and A.state!='' and A.state IS NOT NULL GROUP BY state ORDER BY total DESC 0 State/Province state Country country Accounts total true By Region/City SELECT UCASE(CONCAT(A.city, ", ", A.state)) as region, UCASE(A.city) as city, UCASE(A.state) as state, UCASE(B.name) as country, count(A.id) as total from %%AGILE_DB_PREFIX%%account A join %%AGILE_DB_PREFIX%%country B on (A.country_id=B.id) A.site_id = %%DEFAULT_SITE%% and A.state!='' and A.state IS NOT NULL and A.city!='' and A.city IS NOT NULL GROUP BY region ORDER BY total DESC 0 City city State/Province state Country country Accounts total true By Postcode SELECT UCASE(A.zip) as region, UCASE(A.city) as city, UCASE(A.state) as state, UCASE(B.name) as country, count(A.id) as total from %%AGILE_DB_PREFIX%%account A join %%AGILE_DB_PREFIX%%country B on (A.country_id=B.id) A.site_id = %%DEFAULT_SITE%% and A.zip!='' and A.zip IS NOT NULL GROUP BY region ORDER BY total DESC 0 Postal Code/ZIP Code region City city State/Province state Country country Accounts total true