December 7th, 2012, 06:54 AM
Is it possible to delete all rows below the ten rows with highest value in a field?
I have a hightscore with ten rows and I don't want to have more than ten rows. So each time someone inserts a highscore, the top ten scores must be found and the one with the lowest value deleted.
December 7th, 2012, 07:19 AM
that sounds like a strange approach.
Just collect all results and calculate the top 10 on the fly:
Then there's no need to fumble with the existing rows every time there's a new entry.
... ORDER BY result DESC LIMIT 10
December 7th, 2012, 10:20 AM
If I do that and don't erase any rows, the table will eventuelly get very large. I want to prevent that.