table1:
id B C D
table2:
id B
将table2的内容插入到table1中,并且要求:
1.不能插入重复的id
2.新插入table1的数据中,C D字段全部为0
id B C D
table2:
id B
将table2的内容插入到table1中,并且要求:
1.不能插入重复的id
2.新插入table1的数据中,C D字段全部为0
调试欢乐多
select id,b,0,0 from table2 where id not in(select id from table1)
select b,0,0 into table1(b,c,d) from table2
然后这样写insert into table1(b,c,d) select b,0,0 from table2
(实际情况不知道是否会无意义?!)