In my table I have two columns, cars.station1_id
and cars.station2_id
. These columns contain an ID number referencing stations.id
.
I need to take the two ID's and retrieve stations.name
for each of them.
How do I do this?
This is my code to join one column:
SELECT station1_id, station2_id FROM cars
LEFT JOIN stations
ON stations.id = cars.station_id