选择语句上的 SQL 内连接
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1940579/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
SQL Inner join on select statements
提问by user235693
I am trying to make an inner join on a select statement like this:
我正在尝试对这样的 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
and I get the following error: ORA-00933 SQL command not properly ended Any help would be appreciated, thank you!
并且我收到以下错误:ORA-00933 SQL 命令未正确结束任何帮助将不胜感激,谢谢!
回答by Egor Rogov
Just remove as
from your query:
只需as
从您的查询中删除:
select *
from (select* from bars where rownum <= 10 ) tab1
inner join (select * from bars where rownum <= 10 ) tab2
on tab1.close=tab2.close
回答by Wade73
I believe the error comes from you needing a semicolon to end the statement. The select looks fine to me otherwise.
我相信错误来自您需要一个分号来结束语句。否则,选择对我来说很好。
回答by stud
just give a whitespace between ')' and 'as':
只需在 ')' 和 '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
回答by Ozan BAYRAM
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)