Insert into b select * from a where exists (select 1 from b where a.id<>b.id and a.name<>b.name)
insert #temp2_wastebookselect a.shopid,a.deptid,a.goodsid,convert(dec(10,2),'0.00'),convert(dec(10,2),'0.00') from #temp1_SaleCost a,#temp2_wastebook b where a.shopid=b.shopid and a.deptid=b.deptid and a.goodsid=b.goodsid 你这样给我改一下吧!给上面插入除过下面语句中的数据
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 )
select *
from a
where exists (select 1 from b where a.id<>b.id and a.name<>b.name)
where a.shopid=b.shopid and a.deptid=b.deptid and a.goodsid=b.goodsid
你这样给我改一下吧!给上面插入除过下面语句中的数据
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 )