--试一下 INSERT T2 SELECT * FROM T1 A WHERE NOT EXISTS (SELECT 1 FROM T2 WHERE A=A.a AND B=A.b)
insert t2 select T.a,T.b from t1 T where not exists (select 1 from t2 where T.a=a and T.b=b)
create table t1 ( a int, b int, c int ) insert t1 select 1,2,3 union all select 2,2,3 union all select 3,2,3 select * from t1create table t2 ( a int, b int ) insert t2 select 1,2 union all select 3,2 select * from t2begin traninsert t2(a,b) select A.a,A.b from t1 A left join t2 B on A.a=B.a and A.b=B.b where B.a is null select * from t2rollback trandrop table t1,t2
INSERT T2
SELECT *
FROM T1 A
WHERE NOT EXISTS
(SELECT 1 FROM T2 WHERE A=A.a AND B=A.b)
(
a int,
b int,
c int
)
insert t1
select 1,2,3 union all
select 2,2,3 union all
select 3,2,3
select * from t1create table t2
(
a int,
b int
)
insert t2
select 1,2 union all
select 3,2
select * from t2begin traninsert t2(a,b)
select A.a,A.b from t1 A left join t2 B on A.a=B.a and A.b=B.b where B.a is null
select * from t2rollback trandrop table t1,t2