SELECT * FROM home_content a WHERE ( SELECT count(id) FROM home_content WHERE class_link = a.class_link AND id > a.id ) <= 2