There are 3 tables: with flights of flights of flights, with names of the airports airport and with names of the cities city . You need to take one of the flights and find out the city of departure and the city of arrival.
in the flight table, the airports are marked fromAirport and toAirport these codes correspond to the airport.code . Each airport.code has its own airport.cityCode . Next on this cityCode you need to select the city city.code . Each city.code has its own city.name is what I need to take. Such is the triple nesting.
Tell me how to do it in one request?
UPD
I tried to use this query:
SELECT * FROM flights, airport, city WHERE flights.fromAirport = airport.code AND flights.toAirport = airport.code ORDER BY flights.upload DESC LIMIT 1; How to cram the third table here - I have no idea.
flights,airport,cityWHEREflights.fromAirport=airport.codeandflights.toAirport=airport.codeORDER BYflights.uploadDESC LIMIT 1 I didn’t even work with a double, I have no idea how to cram the third table here - user193361