insert into [c] select * from [a] union all select * from [b];-- 不知道 lz 说的相同是完全相同,还是某些字段相同。 -- 如果是前者,则将上面语句中的 union all 换成 union。 -- 如果是后者,可以参考精化贴中的去重语句。例如, delete t from [c] t where exists (select * from [c] where [相同的字段]=t.[相同的字段] and [某一不相同的字段]>t.[某一不相同的字段])
--使用union合并a,b两表,然后去掉重复. insert into c select * from a union select * from b
insert into c select distinct * from ( select * from a union all select * from b )t
insert into [c]
select * from [a]
union all
select * from [b];-- 不知道 lz 说的相同是完全相同,还是某些字段相同。
-- 如果是前者,则将上面语句中的 union all 换成 union。
-- 如果是后者,可以参考精化贴中的去重语句。例如,
delete t from [c] t where exists (select * from [c] where [相同的字段]=t.[相同的字段] and [某一不相同的字段]>t.[某一不相同的字段])
insert into c
select * from a
union
select * from b
select distinct *
from ( select * from a
union all select * from b )t