You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Joshua Kahn <jk...@yahoo.com> on 2004/06/09 17:10:53 UTC

Nested Select Statements

Hello-

We are attempting to use OJB in an environment in
which a query can return a very large number of
results.  We would like to be able to limit the
returned results to only the 10 at the top of the
ordered list.  

In SQL, the statement would be along the lines of:
select * from 
(select * from table where ... order by ...) where
rownum < 10;

Essentially, the outer select statement can be
hardcoded, but the inner is dependent on the current
query.

Is it possible to do this with OJB?

Thanks,
Josh



	
		
__________________________________
Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/ 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: Nested Select Statements

Posted by "Charles N. Harvey III" <ch...@alloy.com>.
Sub queries are possible if you use ReportQueryByCriteria.  I didn't know
this at first because I am new to the database world, but a Report Query
is a sub query.  :)

But, OJB does not have the "proper" support (yet?) for TOP, LIMIT, ROWNUM.
Because each database vendor supports that feature differently, OJB does
not perform this funtion on the database end, it does it in the java.
The whole collection is selected into the java, and then it is limited to
10.

http://db.apache.org/ojb/query.html#report%20queries


Charlie



Joshua Kahn said the following on 6/9/2004 11:10 AM:

>Hello-
>
>We are attempting to use OJB in an environment in
>which a query can return a very large number of
>results.  We would like to be able to limit the
>returned results to only the 10 at the top of the
>ordered list.  
>
>In SQL, the statement would be along the lines of:
>select * from 
>(select * from table where ... order by ...) where
>rownum < 10;
>
>Essentially, the outer select statement can be
>hardcoded, but the inner is dependent on the current
>query.
>
>Is it possible to do this with OJB?
>
>Thanks,
>Josh
>
>
>
>	
>		
>__________________________________
>Do you Yahoo!?
>Friends.  Fun.  Try the all-new Yahoo! Messenger.
>http://messenger.yahoo.com/ 
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>
>  
>

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org