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