请教关于表B的数据录入表A的SQL问题.
A表已有多个编码和B表一样的,现在要求把B表中跟A表编码不同的录入A表,相同的就不录入.谢谢 问题点数:20、回复次数:5Top
1 楼victorycyz(--)回复于 2003-12-01 17:02:24 得分 0
insert into B select * from a left join B on a.id=b.id where b.id is nullTop
2 楼zjcxc(邹建)回复于 2003-12-01 17:04:01 得分 20
insert into B表
select a.* from A表 a left join B表 b on a.编码=b.编码
where b.编码 is nullTop
3 楼zjcxc(邹建)回复于 2003-12-01 17:06:06 得分 0
或:
insert into B表
select * from A表 where 编码 not in(select 编码 from B表)Top
4 楼lsllp(lsllp)回复于 2003-12-01 17:46:51 得分 0
insert into a
select * from b where 編碼 not in ( select 編碼 from a )Top
5 楼zbyh331(我才刚上路耶!)回复于 2003-12-01 19:25:51 得分 0
insert into B表
select * from A表 where 编码 not in(select 编码 from B表)
Top




