2
J'ai ces deux tablesrequête mysql - 2 clés étrangères
airports: airportid, airportname
flights: flightid, from_airport, to_airport
où from_airport
et to_airport
sont les clés étrangères.
Je peux joindre des tables soit sur airportid
et from_airport
ou airportid
et to_airport
et soit je reçois le nom de to_airport
ou le nom de from_airport
mais je veux sélectionner les deux to_airport
et from_airport
noms soit dans une requête ou à un coût minimal.
Est-ce possible? Comment??
Voici ma question:
SELECT
flight.idflight,
flight.idairline,
flight.from_airport,
flight.to_airport,
flight.number,
airports.name AS origin
FROM
flight
Inner Join airports ON flight.from_airport = airports.idairports