繁体   English   中英

select语句上的SQL内连接

[英]SQL Inner join on select statements

我试图在这样的选择语句上进行内部联接:

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命令未正确结束任何帮助将不胜感激,谢谢!

只是删除as您查询:

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

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

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)

只需在')'和'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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM