I have a webshop which has gotten some duplicate orders because of paypal sending some payment notifications twice or even 3-4-5 times, with random interval between them, ranging from seconds to minutes.
Example from my orders-table:
ID productname buyer timestamp
1 apples john 2014-07-01 19:22:20
2 bananas john 2014-07-01 19:22:20
3 oranges mary 2014-07-01 19:22:52
4 apples john 2014-07-01 19:22:53
5 bananas john 2014-07-01 19:22:53
6 apples chris 2014-07-01 19:22:54
I want to delete all duplicate rows, and by duplicate i mean that productname, buyer and date of purchase should be equal. (only date, not the time part of the timestamp)
So from the table above, this should be deleted:
4 apples john 2014-07-01 19:22:53
5 bananas john 2014-07-01 19:22:53
Because he bought the same things earlier the same day.
How would you go about doing this?