I have a table with object varchar
and score int
. I would like to DELETE all except the top 100 scoring items. Is this possible?
1 Answer
mysql's delete support both order by and limit so you should be find doing following:
select count(*) from t;
delete from t order by score asc limit resultFromPrevious-100;