How to do INNER JOI...
 
Share:
Notifications
Clear all

How to do INNER JOIN on multiple columns in SQL?


Neha
 Neha
(@asha)
Member Admin
Joined: 4 years ago
Posts: 31
Topic starter  

I'm working on a homework project and I'm supposed to perform a database query that finds flights either by the city name or the airport code, but the flights table only contains the airport codes so if I want to search by city I have to join on the airports table.


Quote
Topic Tags
myTechMint
(@mytechmint)
Member Moderator
Joined: 4 years ago
Posts: 52
 

You can do INNER JOIN on multiple columns in SQL as shown below:

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

Neha liked
ReplyQuote