SQL joins tend to become very complex (and not very readable) as the number of tables involved becomes large. An alternative is to select into a temporary table and then use that data in the joins.
CREATE TEMPORARY TABLE can_offices SELECT * FROM company.offices o WHERE o.country_code='CAN';
You can then use the temp table to do joins etc.
SELECT * from company c, offices o WHERE c.company_ID = o.company_ID
mysql export resultset as table
mysql import resultset as table
mysql export resultset as variable
sql select where in
subselect sub select