SELECT codo, ubicacion, COUNT (palacio) AS num_estands FROM palacios, estands WHERE palacios.codigo = estands.palacio GROUP BY codigo, ubicacio ORDER BY num_estands
SELECT codigo, COUNT (asignan.palacio) AS personas_asignadas FROM palacios LEFT OUTER JOIN asignan ON palacios.codigo = asignan.palacio GROUP BY codigo
SELECT codigo, COUNT (incorporan.palacio) AS personas_incorporadas FROM palacios LEFT OUTER JOIN incorporan ON palacios.codigo = incorporan.palacio GROUP BY codigo
select a.codigo, a.ubicacion, a.num_estands, b.personas_asignadas, c.personas_incorporadasfrom(SELECT codigo, ubicacion, COUNT (palacio) AS num_estands FROM palacios, estands WHERE palacios.codigo = estands.palacio GROUP BY codigo, ubicacion ) ainner join(SELECT codigo, COUNT (asignan.palacio) AS personas_asignadas FROM palacios LEFT OUTER JOIN asignan ON palacios.codigo = asignan.palacio GROUP BY codigo) bon a.codigo = b.codigoinner join(SELECT codigo, COUNT (incorporan.palacio) AS personas_incorporadas FROM palacios LEFT OUTER JOIN incorporan ON palacios.codigo = incorporan.palacio GROUP BY codigo) con a.codigo = c.codigoorder by a.codigo, a.ubicacion;