Re: Last Inserted ID Using LOAD DATA

2006-09-21 Thread Visolve DB Team
Thanks ViSolve DB Team. - Original Message - From: Michael Stearne [EMAIL PROTECTED] To: mysql@lists.mysql.com Cc: Jim Ginn [EMAIL PROTECTED] Sent: Tuesday, September 19, 2006 10:11 PM Subject: Last Inserted ID Using LOAD DATA I have a group of updates that need to be done using LOAD DATA

Last Inserted ID Using LOAD DATA

2006-09-19 Thread Michael Stearne
I have a group of updates that need to be done using LOAD DATA INFILE. Within this file there are some INSERTS. Is there anyway that after an INSERT happens I can use the auto-increment ID that was just generated in the next statement. Similar to PHP's mysql_insert_id() function. Thanks,

Re: [Fwd: Re: Last inserted ID]

2004-05-08 Thread Nathan Jones
On Wed, 2004-05-05 at 22:49, Paul DuBois wrote: At 22:39 -0400 5/5/04, Nathan Jones wrote: Hi there, I seem to be having a problem retrieving the last inserted ID for a table. The query I am using is as follows: It's far easier than anyone else has mentioned, as of my

RE: Last inserted ID

2004-05-06 Thread Erich Beyrent
Well, you don't need the distinct. Are you inserting with your PHP script? LAST_INSERT_ID(), as per the manual, only returns the id from the last insert on that connect. You cannot get the LAST_INSERT_ID() for another connection. j- k- I used distinct because otherwise, I was

Last inserted ID

2004-05-05 Thread Erich Beyrent
Hi there, I seem to be having a problem retrieving the last inserted ID for a table. The query I am using is as follows: mysql select distinct LAST_INSERT_ID() as LastID from listings; ++ | LastID | ++ | 3575 | ++ 1 row in set (0.00 sec) However, when I run this from

Re: Last inserted ID

2004-05-05 Thread Joshua J. Kugler
Beyrent said something like: Hi there, I seem to be having a problem retrieving the last inserted ID for a table. The query I am using is as follows: mysql select distinct LAST_INSERT_ID() as LastID from listings; ++ | LastID | ++ | 3575 | ++ 1 row in set (0.00

Re: Last inserted ID

2004-05-05 Thread Daniel Kasak
Erich Beyrent wrote: Hi there, I seem to be having a problem retrieving the last inserted ID for a table. The query I am using is as follows: mysql select distinct LAST_INSERT_ID() as LastID from listings; ++ | LastID | ++ | 3575 | ++ 1 row in set (0.00 sec

Re: Last inserted ID

2004-05-05 Thread Paul DuBois
At 21:11 -0400 5/5/04, Erich Beyrent wrote: Hi there, I seem to be having a problem retrieving the last inserted ID for a table. The query I am using is as follows: mysql select distinct LAST_INSERT_ID() as LastID from listings; This can be simplified as SELECT LAST_INSERT_ID as LastID; no need

Re: Last inserted ID

2004-05-05 Thread Paul DuBois
At 20:34 -0500 5/5/04, Paul DuBois wrote: At 21:11 -0400 5/5/04, Erich Beyrent wrote: Hi there, I seem to be having a problem retrieving the last inserted ID for a table. The query I am using is as follows: mysql select distinct LAST_INSERT_ID() as LastID from listings; This can be simplified

[Fwd: Re: Last inserted ID]

2004-05-05 Thread Nathan Jones
Hi there, I seem to be having a problem retrieving the last inserted ID for a table. The query I am using is as follows: It's far easier than anyone else has mentioned, as of my writing. Just use the PHP function 'mysql_insert_id()' after your insert query. This function has been

Re: [Fwd: Re: Last inserted ID]

2004-05-05 Thread Paul DuBois
At 22:39 -0400 5/5/04, Nathan Jones wrote: Hi there, I seem to be having a problem retrieving the last inserted ID for a table. The query I am using is as follows: It's far easier than anyone else has mentioned, as of my writing. Just use the PHP function 'mysql_insert_id()' after your

Last inserted id

2004-02-19 Thread Binay
Hi I have a php script which insert a row in one of my table. Now i want the auto_generated id produced by this insert query. I know i can use mysql_insert_id function to fetch that auto_generated id. But my question is say two or more person visiting the same page/script causes a insert

Re: Last inserted id

2004-02-19 Thread Mark Maunder
The two simultaneous insert statements will be have separate connections to the database and last_insert_id() is connection specific. So if you're running apache, and you're worried about two different apache child processes getting the same connection ID, don't. Because those two children will

Re: Last inserted id

2004-02-19 Thread Mark Maunder
'connection ID' below should be 'last insert id'. Sorry, it's 2am here and I'm fresh out of coffee. BTW the information you want is here: http://www.mysql.com/doc/en/Information_functions.html#IDX1409 The last ID that was generated is maintained in the server on a per-connection basis. This means

Re: Last inserted id

2004-02-19 Thread Egor Egorov
Binay [EMAIL PROTECTED] wrote: Hi I have a php script which insert a row in one of my table. Now i want the auto_generated id produced by this insert query. I know i can use mysql_insert_id function to fetch that auto_generated id. But my question is say two or more person visiting the

Re: Last inserted id

2004-02-19 Thread Binay
Thanks Mark... You popped me out of great confusion/problem. Binay - Original Message - From: Mark Maunder [EMAIL PROTECTED] To: Binay [EMAIL PROTECTED] Cc: mysql users [EMAIL PROTECTED] Sent: Thursday, February 19, 2004 3:03 PM Subject: Re: Last inserted id 'connection ID' below

Re: Last inserted id

2004-02-19 Thread Paul DuBois
At 9:33 + 2/19/04, Mark Maunder wrote: 'connection ID' below should be 'last insert id'. Sorry, it's 2am here and I'm fresh out of coffee. BTW the information you want is here: http://www.mysql.com/doc/en/Information_functions.html#IDX1409 The last ID that was generated is maintained in the

Re: Last inserted id

2004-02-19 Thread Toro Hill
This will only be a problem if the two inserts are using the same mysql connection/link_indentifier. This isn't usually the case in a web environment, unless you are using a persistent mysql connection across multiple instances of the same script. mysql_insert_id() returns the last insert id

Beginner question - getting last inserted ID

2001-11-09 Thread Anna Åhnberg
Hello! I am working on my first MySQL client. I have a number of tables, each containing a AUTO_INCREMENT PRIMARY KEY column. The client is built in Java and using a JDBC-bridge to connect to the database. When I do an insert in one of these tables the primary key column gets a new ID. How do I

Re: Beginner question - getting last inserted ID

2001-11-09 Thread Carl Troein
Anna Åhnberg writes: When I do an insert in one of these tables the primary key column gets a new ID. How do I get this ID? I guess I cannot use SELECT MAX(id) FROM Table since old, deleted id's are reused for new rows. Please, help me! I shall help you help yourself, for from that

Re: Beginner question - getting last inserted ID

2001-11-09 Thread Kodrik
The manual has all the necessary information: http://www.mysql.com/doc/C/R/CREATE_TABLE.html http://www.mysql.com/doc/e/x/example-AUTO_INCREMENT.html The unofficial FAQ has a chapter on AUTO_INCREMENT: http://www.bitbybit.dk/mysqlfaq/faq.html#ch6_0_0 What you're looking for is probably

Re: Beginner question - getting last inserted ID

2001-11-09 Thread Carl Troein
Anna Åhnberg writes: Thanks, I actually already found the chapters but now I also now how to use the function too! Let me quote from the manual: LAST_INSERT_ID([expr]) Returns the last automatically generated value that was inserted into an AUTO_INCREMENT column. mysql select

RE: Beginner question - getting last inserted ID

2001-11-09 Thread Johnson, Gregert
:[EMAIL PROTECTED]] Sent: Friday, November 09, 2001 10:41 AM To: [EMAIL PROTECTED] Subject:Re: Beginner question - getting last inserted ID Anna Åhnberg writes: Thanks, I actually already found the chapters

Re: Beginner question - getting last inserted ID

2001-11-09 Thread alec . cawley
Anna Åhnberg writes: Thanks, I actually already found the chapters but now I also now how to use the function too! Let me quote from the manual: LAST_INSERT_ID([expr]) Returns the last automatically generated value that was inserted into an AUTO_INCREMENT column. mysql

Re: Beginner question - getting last inserted ID

2001-11-09 Thread William R. Mussatto
On Fri, 9 Nov 2001, Carl Troein wrote: Date: Fri, 09 Nov 2001 15:41:21 GMT From: Carl Troein [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Re: Beginner question - getting last inserted ID Anna Åhnberg writes: Thanks, I actually already found the chapters but now I also now how