select buses.bus_no,
buses.bus_name
from buses
join
(
select sc1.bus_no
from schedule as sc1
join schedule as sc2 on sc1.source = sc2.destination
and sc1.destination = sc2.source
) as s1 on buses.bus_no = s1.bus_no;
答案 0 :(得分:1)
Oracle不支持as
表别名。所以,你可以写成:
select b.bus_no, b.bus_name
from buses b join
(select sc1.bus_no
from schedule sc1 join
schedule sc2
on sc1.source = sc2.destination and sc1.destination = sc2.source
) s1
on b.bus_no = s1.bus_no;