select语句上的SQL内连接

时间:2009-12-21 14:59:26

标签: sql oracle ora-00933

我正在尝试在这样的select语句上进行内部联接:

select *
from (select* from bars  where rownum <= 10 )as tab1
inner join (select * from bars  where rownum <= 10 )as tab2
on tab1.close=tab2.close

我收到以下错误: ORA-00933 SQL命令未正确结束 任何帮助将不胜感激,谢谢!

4 个答案:

答案 0 :(得分:44)

只需从查询中删除as

select *
from (select* from bars  where rownum <= 10 ) tab1
inner join (select * from bars  where rownum <= 10 ) tab2
on tab1.close=tab2.close

答案 1 :(得分:2)

我认为错误来自你需要一个分号来结束语句。否则,选择对我来说很好。

答案 2 :(得分:1)

select * from 
((select* from bars  where rownum <= 10 )as tab1
inner join (select * from bars  where rownum <= 10 )as tab2
on tab1.close=tab2.close)

答案 3 :(得分:1)

只需在')'和'as'之间添加一个空格:

select * from (select* from bars  where rownum <= 10 ) as tab1
 inner join
 (select * from bars  where rownum <= 10 ) as tab2
 on
 tab1.close=tab2.close