私はMYSQLの初心者です。これについての助けに感謝します。2つのテーブルを結合するクエリ
私は2つのテーブルの空港や記事次のフィールドであります
空港を
id, Airport-code, Airport_name
投稿
id, Source_Airport_code, Destination_airport_code, Date_of_departure, preference
私は、次のフィールドを持つレコードを取得するにはどうすればよいです(ソースと目的地はコードの代わりに空港名に対応しています):
select
s.airport_name as source,
d.airport_name as destination,
p.date_of_departure
from posts p
inner join airports s
on p.source_airport_code = s.id
inner join airports d
on d.source_airport_code = d.id
そして私はそれを言うことを憎むが、私はあなたが行くには長い道のりがあると思う:
Source, destination, date_of_departure
はD'ああ - 私はあなたが正しいと思います。私はもっと慎重に読むべきだった。 – MJB