tags:

views:

150

answers:

3

Hello, 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!

A: 

You don't have a space between "select" and "" in "select".

mprudhom
+4  A: 

See answers to the original question

rosscj2533
A: 

Not quite sure why you doing that but dont forget you can alias the same table.

e.g.

SELECT * 
FROM bars b1

   INNER JOIN bars b2 ON b1.close = b2.close
   b2.rownumber <= 10

WHERE b1.rownumber <= 10
kevchadders
I tried to use rownum at the end on the aliases but it didn't work, it only worked on the result of the inner join