这个比较烦,应该还是可以做的:
(不换乘的结果)
select a.route_id, NULL, a.route_id
from route_station a
where 1 in (select station_id from a)
and 8 in (select station_id from a);
换乘一次:
select a.route_id,a.station_id, b.route_id
from route_station a, route_station b
where a.route_id<>b.route_id and a.station_id=b.station_id
and 1 in (select station_id from a) and 8 in (select station_id from b)
换乘两次的按照换乘一次的扩展一下应该不难。