0

こんにちは、、、という名前のテーブルが 3 つありairportsます。このテーブルから、次のようなフィールドを取得する必要があります。flightscheckin

flight.code,
flight.start_time,
flight.end_time,
flights.start_id,
flights.endid,
airports.name as sloc,
airports.name as eloc

条件は次のとおりです。

ckeckin.flight_id = flights.id,
airport.id = flights.startid, --for sloc
airports.id = flights.endid --for eloc
4

1 に答える 1

1

このようなもの?

select flights.code, flights.start_time, flights.end_time, 
flights.start_id, flights.endid, 
a.name as sloc, b.name as eloc
from flights
left join airports a on (flights.start_id = a.id)
left join airports b on (flights.endid = b.id)
于 2012-09-28T09:45:01.343 に答える