有表1Air,字段:id,fromCityId,toCityId,price,dateTimes 表2City,字段:id,cityName
怎样查出:编号、出发城市、到达城市、价格、时间?????
------解决方案--------------------------------------------------------
看不懂你想表达什么
怎样查出:编号、出发城市、到达城市、价格、时间? select * from 1Air不就行了
------解决方案--------------------------------------------------------
- SQL code
select a.*,c1.cityname as 出发城市,c2.cityname as 到达城市 from air a left join city c1 on c1.id = a.fromCityId left join city c2 on c2.id = a.toCityID
------解决方案--------------------------------------------------------
- SQL code
SELECT A.id, C1.cityName fromCityName, C2.cityName toCityName, A.price, A.dateTimesFROM Air AJOIN City C1ON A.fromCityId=C1.idJOIN City C2ON A.toCityId=C2.id