试试这个:
select t1.* from attachments t1left join attachments t2on t1.entity_id = t2.entity_id and t1.group_id = t2.group_id and t1.version_number < t2.version_numberwhere t2.version_number is null

试试这个:
select t1.* from attachments t1left join attachments t2on t1.entity_id = t2.entity_id and t1.group_id = t2.group_id and t1.version_number < t2.version_numberwhere t2.version_number is null