Finding then deleting in mySQL

From: Date: Tue, 06 Aug 2002 11:44:09 +0000
Subject: Finding then deleting in mySQL
Groups: php.qa 
Request: Send a blank email to php-qa+get-5689@lists.php.net to get a copy of this message
First off, I know this is probably extrememly easy, just I've thought about it too much. OK, what I have is a table (the describe is at the bottom). So far, I can run queries like: select min(EXPIRE) as lowest_expire from CreditManager where USERNAME="some@email.address" order by lowest_expire desc limit 1; and that displays the lowest EXPIRE value for a given username. Well, what I want to do in total is to get the lowest EXPIRE value from a given user, then delete that row. I can do the first part just fine... but I've tried many times to get DELETE to work, but it hasn't been (if ya know what I mean). How should I do this? I'm working in PHP, so it doesn't have to be all in mySQL to do everything. Thanks in advance! Andrew (It's a copy from phpMySQLAdmin and it messed up in the copy...but it's readable) Field Type Null Key Default Extra PID mediumint(9) PRI NULL auto_increment USERNAME tinytext EXPIRE tinyint(4) 0 PURCHASED tinytext STATUS enum('used','unused','expired') unused

« previous php.qa (#5689) next »