sql 发表于 2020-09-02 更新于 2020-12-02 合并多行表记录 1select code,sum(nums) as counts from table group by code 将几种 group 合并为一个 123456789101112131415161718192021222324select thecode, sum(counts)from ( select case when code = '01' then '00' else code end as thecode, counts from ( select code, sum(nums) as counts from table group by code ) )group by thecode db2