SELECT c.url_rewrite as comune,r.url_rewrite as regione FROM comuni c INNER JOIN provincie p ON (p.id=c.id_provincia) INNER JOIN regioni r ON (r.id=p.id_regione) WHERE c.nome='sarnano' OR c.url_rewrite='sarnano'