update table1 set field1=table2.field1,field2=table2.field2 from table2 where table1.id=table2.id
update d set d.iprice=b.iprice,d.iunitcost=d.iprice/d.iquantity from rdrecord a,rdrecords b,rdrecord c,rdrecords d
where a.cdefine1=c.cdefine1 and a.id=b.id and c.id=d.id and a.crdcode='25' and a.cvouchtype='08' and c.crdcode='15' and c.cvouchtype='09' and a.ddate>=@datestart and a.ddate<=@dateend
select djid from (select DISTINCT djid,cwhcode,CONVERT(varchar(100), ddate, 23)ddate,cCuscode,cmaker,cmemo,cdepcode,cVenCode from dev_gb_rdrecord)a group by djid having count(*)>1
本文深入探讨了使用SQL进行批量更新的高效方法,包括通过连接多个表来更新字段,以及处理重复记录的策略。示例展示了如何从一个表更新到另一个表的对应字段,以及如何在存在多个相同djid的情况下进行处理。

2838

被折叠的 条评论
为什么被折叠?



