Skip navigation links

MySQL Forums :: Newbie :: DELETE rows?


Advanced Search

DELETE rows?
Posted by: Shah Sahab ()
Date: June 15, 2010 08:53PM

Hi, I am kinda new to mysql. Here is my question:

Let's say I have a table with two cols, id and number. Some of the ids are duplicated in two different rows (max. two rows). For a given such id I would like to delete the row with greater value of number. Can I write a query or multiple queries to do something like that, or I will have to write a php code to do that.

Here is the sample data:

"id1", 20
"id2", 1
"id2", 3 <- need to delete this
"id3", 4
"id4", 1
"id3", 6 <- need to delete this

Any guru out there?

Options: ReplyQuote


Subject Written By Posted
DELETE rows? Shah Sahab 06/15/2010 08:53PM
Re: DELETE rows? Chad Bourque 06/15/2010 10:38PM
Re: DELETE rows? Shah Sahab 06/15/2010 11:23PM
Re: DELETE rows? laptop alias 06/16/2010 02:29AM
Re: DELETE rows? Chad Bourque 06/16/2010 07:44AM
Re: DELETE rows? Shah Sahab 06/17/2010 10:07PM
Re: DELETE rows? Chad Bourque 06/17/2010 11:40PM
Re: DELETE rows? Shah Sahab 06/18/2010 09:43AM
Re: DELETE rows? Chad Bourque 06/18/2010 10:26AM
Re: DELETE rows? Shah Sahab 06/19/2010 07:26AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.