Re: Query for Most Recent Entry

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thompson, Jimi wrote:

I'm trying to figure out how to write a MySQL query that will return the
highest primary key a table.

1) Why?

2) SELECT MAX(id) FROM table

3) If you're trying to find the key of the last row inserted to an auto_increment column, use mysql_insert_id() or LAST_INSERT_ID() in PHP and MySQL, respectively.

--
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux