Re: [sqlite] next value in sequence

2010-08-31 Thread Max Vlasov
On Tue, Aug 31, 2010 at 9:07 AM, Eric Smith wrote: > > You probably don't want 'SELECT max(foo_id)+1' because I think that does > a full table scan. > > you're right, but slightly modified version SELECT (SELECT max(foo_id) FROM MxVft_FTIndex)+1 does not Max _

Re: [sqlite] next value in sequence

2010-08-31 Thread Scott Frankel
On Aug 30, 2010, at 10:07 PM, Eric Smith wrote: > Scott Frankel wrote: > >> Hi all, >> >> How does one find the next value of a serial item? Given a simple >> table with a serial primary key, I'd like to get the next available >> integer key value. eg: >> >> CREATE TABLE foo ( >> foo_id

Re: [sqlite] next value in sequence

2010-08-31 Thread Eric Smith
Scott Frankel wrote: > Hi all, > > How does one find the next value of a serial item? Given a simple > table with a serial primary key, I'd like to get the next available > integer key value. eg: > > CREATE TABLE foo ( > foo_id SERIAL PRIMARY KEY, > name

Re: [sqlite] next value in sequence

2010-08-30 Thread Scott Frankel
Perfect. Thanks! On Aug 30, 2010, at 9:37 PM, Benoit Mortgat wrote: > On Tue, Aug 31, 2010 at 05:45, Scott Frankel > wrote: > >> >> Hi all, >> >> How does one find the next value of a serial item? >> >> SELECT ???; >>> >> > > max(foo_id) + 1 > > -- > Benoit Mortgat > 20, avenue Marcel Paul

Re: [sqlite] next value in sequence

2010-08-30 Thread Benoit Mortgat
On Tue, Aug 31, 2010 at 05:45, Scott Frankel wrote: > > Hi all, > > How does one find the next value of a serial item? > > SELECT ???; > > > max(foo_id) + 1 -- Benoit Mortgat 20, avenue Marcel Paul 69200 Vénissieux, France +33 6 17 15 41 58 +33 4 27 11 61 23 __

[sqlite] next value in sequence

2010-08-30 Thread Scott Frankel
Hi all, How does one find the next value of a serial item? Given a simple table with a serial primary key, I'd like to get the next available integer key value. eg: CREATE TABLE foo ( foo_id SERIAL PRIMARY KEY, nametextDEFAU