ORA-00907:缺少右括号错误

时间:2017-06-27 15:11:55

标签: sql oracle join

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;

1 个答案:

答案 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;