我有表结构,在我的旧问题中解释
MYSQL AND query to satisfy on same column
我有一张桌子,我会用停靠点添加公交车时间。比如说如果公共汽车A,B,C在悉尼到墨尔本之间旅行,那么我的公交车时刻表可能包含类似的内容
id | route_id | stop_id | bus_id | bus_timing | trip | trip_direction
1 | route_1 | Sydney | bus_1 | 07:05:00 | First_trip | Sydney _to_Melbourne
2 | route_1 | Sydney | bus_2 | 07:10:00 | First_trip | Sydney _to_Melbourne
3 | route_1 | Sydney | bus_3 | 07:15:00 | First_trip | Sydney _to_Melbourne
4 | route_1 | Melbourne| bus_1 | 07:20:00 | First_trip | Sydney _to_Melbourne
5 | route_1 | Melbourne| bus_2 | 07:25:00 | First_trip | Sydney _to_Melbourne
6 | route_1 | Melbourne| bus_3 | 07:30:00 | First_trip | Sydney _to_Melbourne
7 | route_1 | Sydney | bus_1 | 07:50:00 | First_trip |Melbourne_to_Sydney
我的问题是
1)如何检索从悉尼到墨尔本两个城市之间的所有公共汽车
2)如果公共汽车没有直接在两个城市之间旅行,那么我需要显示相互连接的公共汽车