SQL 内连接 select 语句

发布于 2024-08-15 03:43:39 字数 265 浏览 6 评论 0原文

我试图在这样的 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 命令未正确结束 任何帮助将不胜感激,谢谢!

I am trying to make an inner join on a select statement like this:

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!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

说谎友 2024-08-22 03:43:39

只需从查询中删除 as 即可:

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

Just remove as from your query:

select *
from (select* from bars  where rownum <= 10 ) tab1
inner join (select * from bars  where rownum <= 10 ) tab2
on tab1.close=tab2.close
因为看清所以看轻 2024-08-22 03:43:39

我相信错误来自于您需要一个分号来结束语句。否则,选择对我来说看起来不错。

I believe the error comes from you needing a semicolon to end the statement. The select looks fine to me otherwise.

时光无声 2024-08-22 03:43:39
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)
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)
沦落红尘 2024-08-22 03:43:39

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

just give a whitespace between ')' and '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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文