如何将数据库中除了id和number两列数据不同外其他都相同的数据合并成一条

就是,只保留一条(number累加),其他都删除, 有没有哪位大哥提供好点的思路?

update table a set 数据 = (select sum(数据) from table b where a.id = b.id)
delete table where id in (select id, max(number) mn from table group by table where number < mn)

其他的列group by,id列取最大值,number取sum
插入新表删除旧表 然后新表改名