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: 1 year ago
Posts: 27
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: 1 year ago
Posts: 29
 

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