[PHP-DB] Finding highest number in auto increment

2002-04-09 Thread Lisi
Each record in my table has a unique ID number generated by auto increment each time a new record is added. This is stored in a field called ID. I have a page that displays records as they are selected, but I want the default to be the latest entry if none has been selected. How do I write

Re: [PHP-DB] Finding highest number in auto increment

2002-04-09 Thread Adam Voigt
SELECT * FROM whatever ORDER BY id DESC; Ofcourse if you want Ascending order, it would be ASC instead of DESC Adam Voigt [EMAIL PROTECTED] On Tue, 09 Apr 2002 15:48:45 +0200, Lisi [EMAIL PROTECTED] wrote: Each record in my table has a unique ID number generated by auto increment each time a

Re: [PHP-DB] Finding highest number in auto increment

2002-04-09 Thread Adam Voigt
Oh, forget to include that if you only want that one record, use the LIMIT 1 keyword as well. Adam Voigt [EMAIL PROTECTED] P.S.: All of this is in the MySQL manual. On Tue, 09 Apr 2002 15:48:45 +0200, Lisi [EMAIL PROTECTED] wrote: Each record in my table has a unique ID number generated by