#始:广州 经:长沙
SELECT AutoID,tb_train_transfer.`ScheduleID`,(Distance-EndGap) as length FROM `tb_train_schedule` INNER JOIN tb_train_transfer on tb_train_schedule.`AutoID`=tb_train_transfer.`ScheduleID`
where tb_train_schedule.`StartStationID`=(select AutoID from tb_train_station where Name like "%广州%")
and tb_train_transfer.`StationID`=(select AutoID from tb_train_station where Name like "%长沙%")
#on 来关联,where 来确定
MySQL-inner join
本文介绍了一种使用SQL查询从广州到长沙列车信息的方法。通过内连接和条件筛选实现了从始发站到目的站的列车时刻表及行程距离的数据获取。

被折叠的 条评论
为什么被折叠?



