Hi! Could we please enable some services and cookies to improve your experience and our website?

SQLize | PHPize | SQLtest

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

A A A
Login    Share code      Blog   FAQ
Copy Format Clear
select distinct ad.aircraft_code, ifnull(sc.business_seats, 0), sc2.economy_seats, sc3.total_seats from aircrafts_data ad left join ( select s.aircraft_code, count( s.fare_conditions) as business_seats from seats s where fare_conditions = 'Business' group by s.aircraft_code ) sc on ad.aircraft_code = sc.aircraft_code join ( select s2.aircraft_code, count( s2.fare_conditions) as economy_seats from seats s2 where fare_conditions = 'Economy' group by s2.aircraft_code ) sc2 on ad.aircraft_code = sc2.aircraft_code join ( select s3.aircraft_code, count( s3.fare_conditions) as total_seats from seats s3 group by s3.aircraft_code ) sc3 on ad.aircraft_code = sc3.aircraft_code

Stuck with a problem? Got Error? Ask AI support!

Copy Clear