RE: select: limit # of rows returned

2005-08-11 Thread Daniel Tripp
Danesh's "fetch first 5" didn't work -- thanks anyway though.

But Amit's java.sql.Statement.setMaxRows() works perfectly.  Nice!



Re: select: limit # of rows returned

2005-08-10 Thread Amit Modi

Daniel Tripp wrote:

Hello.  I'm trying to limit the number of rows returned by a select 
statement.  I know that other databases have way to do this, such as:
 
select * top 10 from thetable
 
set rowcount 5

select * from thetable
 
select * from thetable limit 10
 
But I gather that these are particular to MySQL / MS SQL / whatever.  
Done anyone know of a way that this can be done with Derby?
 
 


Hi Daniel,
   I was having same situation in my project,
   I have one solution which works quite well, not very sure whether it 
is proper or not,

   You can set max count on the java.sql.Statement object in java.
And once you have set, then execute the query.

Hope this will solve your problem.

Regards:
Amit Modi
begin:vcard
fn:Amit Modi
n:Modi;Amit
org:PSPL, Nagpur
adr:Second Floor, Infotech Tower;;Persistent Systems Pvt. Ltd.;Nagpur;Maharashtra;444203;India
email;internet:[EMAIL PROTECTED]
title:MTS
tel;work:0712 2226900 X: 409
tel;cell:09422881563
url:http://www.persistent.co.in
version:2.1
end:vcard



Re: select: limit # of rows returned

2005-08-10 Thread Danesh
This is DB2 syntax but it might work with Derby.. try

select * from thetable fetch first 5 rows only

Regards,
~danesh

On 8/10/05, Daniel Tripp <[EMAIL PROTECTED]> wrote:
>  
> Hello.  I'm trying to limit the number of rows returned by a select
> statement.  I know that other databases have way to do this, such as: 
>   
> select * top 10 from thetable 
>   
> set rowcount 5 
> select * from thetable 
>   
> select * from thetable limit 10 
>   
> But I gather that these are particular to MySQL / MS SQL / whatever.  Done
> anyone know of a way that this can be done with Derby? 
>   
>


select: limit # of rows returned

2005-08-10 Thread Daniel Tripp
Title: Message



Hello.  I'm 
trying to limit the number of rows returned by a select statement.  I know 
that other databases have way to do this, such as: 
 
select * top 10 from 
thetable
 
set rowcount 
5
select * from 
thetable
 
select * from 
thetable limit 10
 
But I gather that 
these are particular to MySQL / MS SQL / whatever.  Done anyone know of a 
way that this can be done with Derby?