22

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!

4

4 回答 4

55

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
于 2009-12-21T15:06:02.317 回答
2

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

于 2009-12-21T15:06:25.180 回答
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)
于 2009-12-21T15:06:04.260 回答
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
于 2011-09-14T05:36:50.430 回答