Page 1 of 1

deleting rows with same value in a single column

Posted: Sun Sep 12, 2010 6:24 pm
by Smudly
I have a mysql table that looks like this:

id int(11) autoincrement
artist varchar(50)
title varchar(50)

I need to check for any rows that have the same titles.
So for example, if I had the following rows:

1 - Bob - Hello World
2 - Charlie Brown - Theme Song
3 - Joe - Hello World
4 - Joe - Is Cool
5 - Bob - Magic Dude

The query would display Row 1, and Row 3 as duplicates. Any idea how I can do something like this?

Re: deleting rows with same value in a single column

Posted: Sun Sep 12, 2010 7:51 pm
by requinix

Code: Select all

SELECT * FROM `table` GROUP BY `title` HAVING COUNT(1) > 1