Teng a Database with the following scheme:
The user belongs to an establishment, the establishment belongs to a municipality, the department has many municipalities and the municipality has many cantons, so I want an SQL query that returns all the cantons of all the municipalities associated with the department where the establishment.
I've tried with:
select ctn.* from ctl_canton ctn left join ctl_municipio muni on ctn.id_municipio=muni.id left join
ctl_establecimiento est on muni.id=est.id_municipio
where est.id=10;
but only brings me the cantons of the municipality where the establishment is and I also want the cantons of their sister municipalities