I have the following two tables:
<html>
<head>
<style>
table, th, td {
border: 1px solid black;
}
</style>
</head>
<body>
<table>
<tr>
<th>airport</th>
</tr>
<tr>
<td>id_airport</td>
</tr>
<tr>
<td>name_airport</td>
</tr>
</table>
<h4>and</h4>
</body>
</html>
<html>
<head>
<style>
table, th, td {
border: 1px solid black;
}
</style>
</head>
<body>
<table>
<tr>
<th>route</th>
</tr>
<tr>
<td>id_route</td>
</tr>
<tr>
<td>id_airport_origin</td>
</tr>
<tr>
<td>id_airport_destination</td>
</tr>
</table>
</body>
</html>
route.id_airport_origin and route.id_airport_destination are both foreign keys of airport.id_airport
I need to query the name_airport column that matches with its foreing keys.
I have tried to execute the following query with no success.
SELECT route.id.route, airport.name_airport, airport.name_airport
FROM route
INNER JOIN airport ON route.id_airport_origin AND route.id_airport.destination = airport.id_airport
I have tried several combinations of the above code but couldn't get the right query.
Any ideas?