Mysql
 sql >> Database >  >> RDS >> Mysql

Query per unire due tabelle

Se l'FK in Posts.*_Airport_code non fa riferimento a Airports.id come MJB presume ma a Airports.Airport_code poi

SELECT
  APS.Airport_name AS Source,
  APD.Airport_name AS Destination,
  Posts.date_of_departure
FROM Posts
  INNER JOIN Airports APS ON(APS.Airport_code = Posts.Source_Airport_code)
  INNER JOIN Airports APD ON(APD.Airport_code = Posts.Destination_airport_code)