LAST_INSERT_ID is connection-specific, not table-specific. When you say,
SELECT LAST_INSERT_ID() FROM foo;
you are asking for the LAST_INSERT_ID to be repeated once for each row of table foo. This is analogous to
SELECT NOW() FROM foo;
or
SELECT 2 FROM foo;
Adding a LIMIT would work, but the simple solution is to leave out the table.
SELECT LAST_INSERT_ID();
Michael
Eric Absgarten wrote:
Hello,
I have a rather simple straightforward question that I was not able to find in any of the documentation.
I am in the process of writing an application, and I was wondering whether there is any benefit (or penalty) in LIMIT(ing) a LAST_INSERT_ID() query?
i.e. SELECT LAST_INSERT_ID() FROM foo vs. SELECT LAST_INSERT_ID() FROM foo LIMIT 1
Thanks in advance, Eric Absgarten
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]