注册 登录
编程论坛 VFP论坛

插入出错,请教

bdx808 发布于 2024-05-12 10:48, 252 次点击
有两个表tb1和tb2结构一样,想把表tb2中身份证号sfzh不在tb1里的数据追加到tb1中,下面的循环哪里错了?
USE tb2
SCAN
   INSERT INTO tb1 SELECT tb2.xm,tb2.sfzh FROM tb1 WHERE tb2.sfzh NOT in (sele sfzh  FROM tb1)
ENDSCAN
SELECT tb1
请高手出手,多谢了!
2 回复
#2
sdta2024-05-12 12:20
INSERT INTO tb1 SELECT tb2.xm,tb2.sfzh FROM tb1 WHERE tb2.sfzh NOT in (sele sfzh  FROM tb1)
改为
INSERT INTO tb1 (xm,sfzh) SELECT tb2.xm,tb2.sfzh FROM tb2 WHERE tb2.sfzh NOT in (sele sfzh  FROM tb1)

[此贴子已经被作者于2024-5-12 12:21编辑过]

#3
bdx8082024-05-12 13:11
sdta大神!
1