I have searched a lot, but I can\'t find an answer or something near.
I have a table like this:
id int(11) NO PRI auto_increment attri
SELECT attribute_id, result FROM TableName a WHERE ( SELECT COUNT(*) FROM TableName b WHERE a.attribute_id = b.attribute_id AND a.result <= b.result ) <= 5