At 20:34 -0500 5/5/04, Paul DuBois wrote:
At 21:11 -0400 5/5/04, Erich Beyrent wrote:
Hi there,

I seem to be having a problem retrieving the last inserted ID for a
table.

The query I am using is as follows:

mysql> select distinct LAST_INSERT_ID() as LastID from listings;

This can be simplified as SELECT LAST_INSERT_ID as LastID; no need to retrieve the value once for every row in the listings table.

Oops, sorry. That should be SELECT LAST_INSERT_ID() as LastID; Forgot the parentheses.

--
Paul DuBois, MySQL Documentation Team
Madison, Wisconsin, USA
MySQL AB, www.mysql.com

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



Reply via email to