in reply to Re: SQL Troubles
in thread SQL Troubles
The most recently generated ID is maintained in the server on a per-connection basis. It will not be changed by another client. It will not even be changed if you update another AUTO_INCREMENT column with a non-magic value (that is, a value that is not NULL and not 0).i.e.
INSERT INTO foo (auto,text) VALUES(NULL,'text'); # generate ID by inserting NULL INSERT INTO foo2 (id,text) VALUES(LAST_INSERT_ID(),'text'); # use ID in second table
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: SQL Troubles
by George_Sherston (Vicar) on Dec 01, 2001 at 17:27 UTC | |
by growlf (Pilgrim) on Dec 01, 2001 at 21:02 UTC | |
by George_Sherston (Vicar) on Dec 03, 2001 at 16:35 UTC |