On Tue, Jun 17, 2003 at 04:02:46PM +0300, Baris Akin wrote: > I try to get last inserted autoincrement record ID on table with > LAST_INSERT_ID() function (SELECT LAST_INSERT_ID() FROM TABLE). Every > connection returns it's own last inserted ID not actual ID. Is this a > bug? Also it returns more than one record (20 rows). >
It's not a bug. LAST_INSERT_ID is meant to return the last inserted ID per connection, NOT per table and NOT per connection per table. The 'FROM TABLE' above is therefore redundant. If LAST_INSERT_ID wasn't kept per connection, it would be useless in multi-user cases. It gives you information on what you just inserted, not what someone else did with another connection. http://www.mysql.com/documentation/mysql/bychapter/manual_Reference.html#IDX1362 Regards, Fred. -- Fred van Engen XB Networks B.V. email: [EMAIL PROTECTED] Televisieweg 2 tel: +31 36 5462400 1322 AC Almere fax: +31 36 5462424 The Netherlands -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]