在A表中安插在B表中的值
在A表中插入在B表中的值
在A表中插入在B表中的值
例:
A表
id name notes
1 2
2 2
1 3
2 3
B表
id name notes
1 2
3 1
2 4
2 3
结果
id name notes
1 2
2 2
1 3
2 3
3 1
2 4
------解决方案--------------------

在A表中插入在B表中的值
例:
A表
id name notes
1 2
2 2
1 3
2 3
B表
id name notes
1 2
3 1
2 4
2 3
结果
id name notes
1 2
2 2
1 3
2 3
3 1
2 4
------解决方案--------------------
INSERT #temp2_wastebook
SELECT a.shopid ,
a.deptid ,
a.goodsid ,
CONVERT(dec(10, 2), '0.00') ,
CONVERT(dec(10, 2), '0.00')
FROM #temp1_SaleCost a
WHERE NOT EXISTS ( SELECT 1
FROM #temp2_wastebook b
WHERE a.shopid = b.shopid
AND a.deptid = b.deptid
AND a.goodsid = b.goodsid )