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 you will benefit in the long run, as will I. 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 LAST_INSERT_ID(), but I'll let you find it yourself. Oops, now I told you. :-P //C -- Carl Troein - Círdan / Istari-PixelMagic - UIN 16353280 [EMAIL PROTECTED] | http://pixelmagic.dyndns.org/~cirdan/ Amiga user since '89, and damned proud of it too. --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php