Service Group Membership SELECT B.sku as group_name, count(A.id) as total from %%AGILE_DB_PREFIX%%account_group A inner join %%AGILE_DB_PREFIX%%service B on A.service_id=B.id A.site_id = %%DEFAULT_SITE%% and A.active=1 AND A.service_id IS NOT NULL and A.service_id!=0 GROUP BY group_name ORDER BY total DESC 0 Group Name group_name true Account Members total true num SELECT B.sku as group_name, count(A.id) as total from %%AGILE_DB_PREFIX%%account_group A inner join %%AGILE_DB_PREFIX%%service B on A.service_id=B.id A.site_id = %%DEFAULT_SITE%% and A.active=1 AND A.service_id IS NOT NULL and A.service_id!=0 GROUP BY group_name ORDER BY total DESC