首先,主建肯定不可能有两个的,首引是可以的 ----------------------------------------------Insert into C Values (Select A.col1,A.Col2,... From A,B Where (A.z1=B.z1 and A.Z2 <> B.Z2) or (A.z1<>B.z1 and A.Z2 = B.Z2) or(A.z1<>B.z1 and A.Z2 <> B.Z2));Insert into C Values (Select B.col1,B.Col2,... From A,B Where (A.z1=B.z1 and A.Z2 <> B.Z2) or (A.z1<>B.z1 and A.Z2 = B.Z2) or(A.z1<>B.z1 and A.Z2 <> B.Z2));
首先跟你说,一个表中是不可能有两个主键的,你的说法有问题,有两个索引差不多 Insert into C Values (fields) select (A.z1=B.z1 and A.Z2 <> B.Z2) or (A.z1<>B.z1 and A.Z2 = B.Z2) or (A.z1<>B.z1 and A.Z2 <> B.Z2)) From A,B
insert 表C select * from 表A where not exists(select 1 from 表B where z1=表A.z1 and z2=表A.z2) union all select * from 表B where not exists(select 1 from 表A where z1=表B.z1 and z2=表B.z2)
----------------------------------------------Insert into C
Values (Select A.col1,A.Col2,...
From A,B
Where (A.z1=B.z1 and A.Z2 <> B.Z2) or (A.z1<>B.z1 and A.Z2 = B.Z2) or(A.z1<>B.z1 and A.Z2 <> B.Z2));Insert into C
Values (Select B.col1,B.Col2,...
From A,B
Where (A.z1=B.z1 and A.Z2 <> B.Z2) or (A.z1<>B.z1 and A.Z2 = B.Z2) or(A.z1<>B.z1 and A.Z2 <> B.Z2));
Insert into C
Values (fields)
select (A.z1=B.z1 and A.Z2 <> B.Z2) or (A.z1<>B.z1 and A.Z2 = B.Z2) or
(A.z1<>B.z1 and A.Z2 <> B.Z2))
From A,B