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
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
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
:[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
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
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