RE: Auto Increment ID of Inserted Row

2003-09-04 Thread Dan Greene
eene > Cc: [EMAIL PROTECTED] > Subject: Re: Auto Increment ID of Inserted Row > > > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Dan Greene wrote: > > > (newbie to MySQL) > > > > I've been banging my head against the wall on this one for >

Re: Auto Increment ID of Inserted Row

2003-09-02 Thread Mark Matthews
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Dan Greene wrote: > (newbie to MySQL) > > I've been banging my head against the wall on this one for a bit now, and I understand that last_insert_id() is per-connection based, but most webapps are connection pooled (simple) or clustered (harder). Wha

Re: Auto Increment ID of Inserted Row

2003-09-02 Thread Dan Greene
(newbie to MySQL) I've been banging my head against the wall on this one for a bit now, and I understand that last_insert_id() is per-connection based, but most webapps are connection pooled (simple) or clustered (harder). What are my options to get the id of the inserted row in a webapp? As a

Re: Auto Increment ID of Inserted Row

2002-09-19 Thread Dan Nelson
In the last episode (Sep 19), Steven Kreuzer said: > >What is the SQL to get the created AutoInc ID from a row that I have > >just inserted? > > SELECT MAX(id_field) FROM table Nope. If someone else inserted a record between the time you inserted yours and the time you run that select, your answ

RE: Auto Increment ID of Inserted Row

2002-09-19 Thread Tam, Michael
not be id you are expecting. Regards, Michael -Original Message- From: Steven Kreuzer [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 19, 2002 10:24 AM To: Davis, Tim Cc: Mysql (E-mail) Subject: Re: Auto Increment ID of Inserted Row SELECT MAX(id_field) FROM table SK On Thursday

Re: Auto Increment ID of Inserted Row

2002-09-19 Thread Rodney Broom
From: Steven Kreuzer <[EMAIL PROTECTED]> > SELECT MAX(id_field) FROM table > On Thursday, September 19, 2002, at 12:55 PM, Davis, Tim wrote: > > What is the SQL to get the created AutoInc ID from a row that I > > have just inserted? More formally, you can do this: SELECT LAST_INSERT_ID(); -

Re: Auto Increment ID of Inserted Row

2002-09-19 Thread Paul DuBois
At 13:23 -0400 9/19/02, Steven Kreuzer wrote: >SELECT MAX(id_field) FROM table That won't give you the correct answer if some other client gets in there an inserts a row before you have a change to get the MAX() value. LAST_INSERT_ID() is designed for this; it's not affected by whatever other cl

Re: Auto Increment ID of Inserted Row

2002-09-19 Thread Steven Kreuzer
SELECT MAX(id_field) FROM table SK On Thursday, September 19, 2002, at 12:55 PM, Davis, Tim wrote: > What is the SQL to get the created AutoInc ID from a row that I have > just > inserted? > > Tim Davis > Sunbelt Systems Concepts, Inc > [EMAIL PROTECTED] > Client/Server Database Programmer/Ana

Re: Auto Increment ID of Inserted Row

2002-09-19 Thread Paul DuBois
At 12:55 -0400 9/19/02, Davis, Tim wrote: >What is the SQL to get the created AutoInc ID from a row that I have just >inserted? SELECT LAST_INSERT_ID(); Seems like there's an echo in here...this question has been asked about 4 times in the last couple of days. :-) > >Tim Davis >Sunbelt Syste

Auto Increment ID of Inserted Row

2002-09-19 Thread Davis, Tim
What is the SQL to get the created AutoInc ID from a row that I have just inserted? Tim Davis Sunbelt Systems Concepts, Inc [EMAIL PROTECTED] Client/Server Database Programmer/Analyst - Before posting, please check: http://w