使用sql语句复制表格数据时如何避免重复?

2025-04-25 18:27:53
推荐回答(1个)
回答1:

你所说的重复项肯定是有条件的,用not exists筛选掉重复项就可以了,即

insert into b select from sum() as...from a where not exists (select 1 from b where 重复项条件)