I've got some MySQL tables with redundant data that I need to remove. For example:
id email date data...
1 [email protected] 2012-01-01 my_data
2 [email protected] 2012-01-01 my_data
3 [email protected] 2012-01-02 my_data
4 [email protected] 2012-01-02 my_data (redundant)
5 [email protected] 2012-01-02 my_data
I need to DELETE the redundant rows, but I'd like to select them first. I found this on StackOverflow, but it requires the email address
SELECT *
FROM `my_table`
WHERE `id` IN (SELECT `id`
FROM `my_table`
where `email` = '[email protected]'
group by `date`
HAVING count(*) > 1)
What query can i use like above that does not use the WHERE qualifier in the embedded query so I can do it fall all email addresses?
The query can be a SELECT query. I don't mind removing the rows manually in PHPMyAdmin.