0

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 1

3

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;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.