Customers by Country and State/Province (All) heading SELECT DISTINCT count(A.id) as total1, C.name as country from %%AGILE_DB_PREFIX%%account A left join %%AGILE_DB_PREFIX%%country C on (A.country_id=C.id) A.site_id = %%DEFAULT_SITE%% AND A.country_id IS NOT NULL AND A.country_id!=0 GROUP BY country ORDER BY total1 ASC 0 Country: country true true true false false Total Customers: total1 SELECT DISTINCT C.name as country, count(A.id) as total2, A.state as region from %%AGILE_DB_PREFIX%%account A left join %%AGILE_DB_PREFIX%%country C on (A.country_id=C.id) A.site_id = %%DEFAULT_SITE%% and C.site_id = %%DEFAULT_SITE%% AND A.country_id IS NOT NULL AND A.country_id!=0 GROUP BY region ORDER BY region ASC 30 State/Province: region true true true false false Total Customers: total2 SELECT DISTINCT A.state as region, C.name as country, A.company, A.email, CONCAT(A.first_name,' ', A.last_name) as name, CONCAT(address1,' ', address1,', ', city, ' ', state, ', ', zip ) as address from %%AGILE_DB_PREFIX%%account A left join %%AGILE_DB_PREFIX%%country C on (A.country_id=C.id) A.site_id = %%DEFAULT_SITE%% and C.site_id = %%DEFAULT_SITE%% AND A.country_id IS NOT NULL AND A.country_id!=0 ORDER BY company ASC 30 > Contact name Company company Address address E-mail email