I need to display the departure and arrival airport codes with their names from another table. But I don’t know how to do this in one request
select flight_no, a.departure_airport, b.airport_name from flights a
join airports_data b on a.departure_airport = b.airport_code
select flight_no, a.arrival_airport, b.airport_name from flights a
join airports_data b on a.arrival_airport = b.airport_code
2
Answers
You can join the tableairport_data twince
You can join
airports_data
asb
andc
and then use the fields ofa
,b
andc
, you can also renameairport_name
inside yourselect
clause to differentiate betweenb
andc