Re: A MySQL question

From: Date: Mon, 14 Jul 2003 21:19:43 +0000
Subject: Re: A MySQL question
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-155178@lists.php.net to get a copy of this message
"Zavaboy" <zavaboy@hotmail.com> wrote in message news:20030714211313.86984.qmail@pb1.pair.com... > Ok, I want to delete only 1 row off of a database table... > Example: > I have a table with columns "user" and "item"... > Lets say the table contains the following rows (user | item): > 582-668243 | Toothbrush > 582-668243 | Toothbrush > 582-668243 | Toothbrush > 582-668243 | Trash can > 582-668243 | Trash can > 582-668243 | Something else > 582-668243 | Something else > 582-668243 | Something else > 582-668243 | Something else > 720-387690 | Dog treats > 720-387690 | Car > 720-387690 | Car > 720-387690 | Toothbrush > 720-387690 | Toothbrush > > Ok, user 582-668243 is buying a lot, eh? LoL > Anyway, how can I remove only 1 Toothbrush from user 582-668243? > I just want the query... I've been trying to find it out for a few hours > now... > > Thanks in advance! > > -- > > - Zavaboy > zavaboy@hotmail.com > www.zavaboy.com You can try putting "LIMIT 1" on the end of your query but to be honest I don't know if LIMIT works with the DELETE command. Worth a try. Ideally you should have an additional column with an autoincrementing value to act as your primary key and you delete on that key. - Kevin

« previous php.general (#155178) next »