mysql 根据字段聚类并选出每组前5条(红色的是筛选条件)
SELECT tbc.name,a.* FROM t_broker_collection_card_ref a
left join t_broker_collection tbc on tbc.id= a.collection_idWHERE 5>(SELECT COUNT(*) FROM t_broker_collection_card_ref b WHERE a.collection_id=b.collection_id and a.id<b.id
) and collection_id in (select id from t_broker_collection where user_id='090c1903e23d4a9882c742b1267af73e') ORDER BY collection_id DESC;