How to do an INNER JOIN on multiple columns

前端 未结 5 2052
春和景丽
春和景丽 2020-11-30 16:57

I\'m working on a homework project and I\'m supposed to perform a database query which finds flights either by the city name or the airport code, but the flights

5条回答
  •  失恋的感觉
    2020-11-30 17:26

    Why can't it just use AND in the ON clause? For example:

    SELECT *
    FROM flights
    INNER JOIN airports
       ON ((airports.code = flights.fairport)
           AND (airports.code = flights.tairport))
    

提交回复
热议问题