Re: need help with a chat code problem
| From: | Erwin | Date: | Fri, 30 Aug 2002 10:15:00 +0000 |
| Subject: | Re: need help with a chat code problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-114630@lists.php.net to get a copy of this message | ||
> as each one I want to delete will be the smallest ID number
> (as it grows with each message added to it).
I think you mean the lowest ID in the table and I suppose you're looking for
a MySQL query. As of MySQL version 4 (currently in development) you can use
"delete from <tablename> where id in (select min( id ) from <tablename>);".
I suppose you're not working with the development version of MySQL. For
MySQL 3.x you will have to use two queries:
- select min(id) from <tablename>
- delete from <tablename> where id=<min(id)>
Unfortunatly it's not possible to do "delete from <tablename> where
id=min(id), because the min-function is a so called "group" function.
Grtz Erwin