At 16:02 +0300 6/17/03, Baris Akin wrote:
Hello,



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 supposed to return the last ID generated on that connection. (I'm not sure what you mean by "actual ID", because I would expect the connection's last ID and actual ID to mean the same thing.)

The reason you get back multiple records is because you're using

SELECT LAST_INSERT_ID() FROM TABLE

rather than

SELECT LAST_INSERT_ID()

What's happening with your query is that you're returning the ID once
per row in your table.  Drop the FROM TABLE in your query and you'll
get just one row back.






Thanks


Baris AKIN

Istanbul/TURKEY


--
Paul DuBois, Senior Technical Writer
Madison, Wisconsin, USA
MySQL AB, www.mysql.com

Are you MySQL certified? http://www.mysql.com/certification/


-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to