Ver originalSELECT t1.municipio,COUNT(t2.id_munic),COUNT(t3.id_munic) FROM tabla t1, tabla t2, tabla t3 WHERE t1.id = t2.id_munic AND t2.id = t3.id_viviend GROPU BY municipio