[thelist] getting last entry from a table (mysql)

Liam Delahunty liam at megaproducts.co.uk
Thu Oct 20 03:37:03 CDT 2005

On 20/10/05, Alex Beston <alex at deltatraffic.co.uk> wrote:
> hi evolt
> im trying to access the most recent row of a table.
> ive used   mysql_insert_id() to get the id of an insert just performed,
> but this one is to find the one with the largest id, which could have
> been added any time in the past.

SELECT stuff FROM your_tbl ORDER BY id_column_name DESC LIMIT 1

Kind regards, Liam Delahunty

More information about the thelist mailing list