Re: Top 1 - Limit 1

2006-09-16 Thread Bernt M. Johnsen
Tim Dudgeon wrote: > > > Bernt M. Johnsen wrote: > >> Tim Dudgeon wrote: >> >>> >>> Yes, but is there an equivalent to the TOP or LIMIT keywords that other >>> databases use? >> >> >> Not in SQL (neither in Derby nor the SQL standard). >> The closest equivalent is Statement.setMaxRows(i). >> >

Re: Top 1 - Limit 1

2006-09-16 Thread Harri Pesonen
It would be great if Derby had TOP (as in SQL Server) and LIMIT (as in MySql), because DataSet does not allow setMaxRows. TOP and LIMIT should support variables: @Select("SELECT TOP ?1 * FROM Users WHERE Pin IS NULL") DataSet getWithoutPin(int top); -- Harri Tim Dudgeon wrote: Bernt M. Joh

Re: Top 1 - Limit 1

2006-09-16 Thread Tim Dudgeon
Bernt M. Johnsen wrote: Tim Dudgeon wrote: Yes, but is there an equivalent to the TOP or LIMIT keywords that other databases use? Not in SQL (neither in Derby nor the SQL standard). The closest equivalent is Statement.setMaxRows(i). So that would not be applied at the query level? State

Re: Top 1 - Limit 1

2006-09-16 Thread Bernt M. Johnsen
Tim Dudgeon wrote: > > > Marl Atkins wrote: > >> This would only work if the ID field is an Identity. >> As it happens, it IS so this should work for me too. >> >> THREE answers to my problem. >> You guys are good THANKS!! > > > Yes, but is there an equivalent to the TOP or LIMIT keywords tha

Re: Top 1 - Limit 1

2006-09-16 Thread Tim Dudgeon
Marl Atkins wrote: This would only work if the ID field is an Identity. As it happens, it IS so this should work for me too. THREE answers to my problem. You guys are good THANKS!! Yes, but is there an equivalent to the TOP or LIMIT keywords that other databases use? Tim

Re: Top 1 - Limit 1

2006-09-14 Thread Francois Orsini
On 9/14/06, Marl Atkins <[EMAIL PROTECTED]> wrote: This would only work if the ID field is an Identity.As it happens, it IS so this should work for me too.THREE answers to my problem. That's one of the nice aspects of  Open Source You get Open Assistance :) or Open Support however you want to call

RE: Top 1 - Limit 1

2006-09-14 Thread Marl Atkins
Subject: Re: Top 1 - Limit 1 I think the IDENTITY_VAL_LOCAL() function is what Marl is actually looking for. http://db.apache.org/derby/docs/10.1/ref/rrefidentityvallocal.html Dan On 14/09/06, Bernt M. Johnsen <[EMAIL PROTECTED]> wrote: > Marl Atkins wrote: > > Hi: > > >

RE: Top 1 - Limit 1

2006-09-14 Thread Marl Atkins
Yes, highest ID = it's an Identity field. It looks to me like either would work. Any idea which has a better performance? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, September 14, 2006 8:04 PM To: Derby Discussion Subject: Re: Top 1 - Li

Re: Top 1 - Limit 1

2006-09-14 Thread Dan Scott
I think the IDENTITY_VAL_LOCAL() function is what Marl is actually looking for. http://db.apache.org/derby/docs/10.1/ref/rrefidentityvallocal.html Dan On 14/09/06, Bernt M. Johnsen <[EMAIL PROTECTED]> wrote: Marl Atkins wrote: > Hi: > > I'm searching the docs and can't find it. > Is there a way

Re: Top 1 - Limit 1

2006-09-14 Thread Bernt M. Johnsen
Marl Atkins wrote: > Hi: > > I'm searching the docs and can't find it. > Is there a way to limit the number of records in the result like: > > Sql Server: Select Top 1 * From MyRecs ORDER BY ID DESC > MySql:Select * From MyRecs ORDER BY ID DESC LIMIT 1 > > Basically, I need the ID of the

Top 1 - Limit 1

2006-09-14 Thread Marl Atkins
Hi: I'm searching the docs and can't find it. Is there a way to limit the number of records in the result like: Sql Server: Select Top 1 * From MyRecs ORDER BY ID DESC MySql: Select * From MyRecs ORDER BY ID DESC LIMIT 1 Basically, I need the ID of the last record inserted. How can I get that?