你所说的重复项肯定是有条件的,用not exists筛选掉重复项就可以了,即
insert into b select from sum() as...from a where not exists (select 1 from b where 重复项条件)