用开窗函数分组排序就行了
select * from (select a.*, row_number() over(partition by 编号 order by id desc) rn from a) as b where b.rn=1
加一个字段SerialNo,取最大的流水号。