簡體   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