var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Rownum query with joins ?
I need a query like this :
select * from (select *from tab1 where rownum < 4) a inner join
(select *from tab2 where rownum < 4) b on a.sno = b.frsno
that is first 4 rows of both the table to be fetched and then over that inner join to be performed.
What is the query for this in Oracle ? The above throws syntax error .
It would help if you told us what syntax error you get. I suspect you are using 8i and the ANSI "inner join" syntax is not supported.
No I am using only 9i, it says that, I can't use sub query there instead of tables in JOIN condition.
Is there any alternative query to below concept :
First choose the first 10 rows of two tables.
And then perform the inner join over the above result set.
Presumably you have hit a 9i restriction - I just checked on 10G and it works there.
You can rewrite using non-ANSI syntax like this:
select * from (select *from tab1 where rownum < 4) a,
(select *from tab2 where rownum < 4) b
where a.sno = b.frsno
That works in 8i, so should be fine in 9i.