SELECT o.country, o.city, count(*) FROM person p JOIN office o ON (p.office_id = o.id) GROUP BY 1, 2 ORDER BY 1, 2;