Hi,
I need to delete excess rows from my table, but ı am
not sure how to do it.
I don't need more than two updates to any item per day
so I want to delete extra ones from the table.
I can not use the unique or distinct filter because I want to allow up to
two rows per day for each item, and delete any above that number.
I have a table containing a weeks worth of daily updates to the my website.
The table contains four records in each row:
day_no, item, quality_score, votes
3, Feedbox, 6, 7
4, Grabber, 2, 23
4, Grabber 4, 20
4, Feedbox, 5, 5
5, Feedbox, 3, 15
6, Feedbox, 8, 31
4, Grabber 7, 4
So you see that last one on the list, that is the 3rd time that item has got an update for day 4, so that row should get deleted but the first two rows should stay intact.
I am not sure if the "DELETE from WHERE" is going to work here because that would probably delete all three rows, which is not what I want.
I just want to delete the 3rd ( and if they exist: the 4th, 5th ...nth rows )
and leave the first two .
Any ideas how this can be done ?
Thanks