Ya tengo el error, es el alias
iataCompanyCode as company en el union ...
Código MySQL:
Ver originalsum(c.numArrivals
) as Arrivals
, sum(c.numDep
) as Departures
count(a.idArrivalFlight
) as numArrivals
, FROM `aodb`.
`arrivalFlight` a
WHERE a.iataCompanyCode
IN ('SPP','IB') AND '2011-09-01 00:00:00' count(b.idDepartureFlight
) as numDep
FROM `aodb`.
`departureflight` b
WHERE b.iataCompanyCode
IN ('SPP','IB') AND '2011-09-01 00:00:00'
O lo quitas o como te he puesto lo usas en el ultimo group by
SELECT c.
company,
sum(c.numArrivals) as Arrivals,
sum(c.numDep) as Departures
FROM (
) as c
GROUP BY c.
company;
Quita los alias en el union no son necesarios...