SQL-根据多个条件更新数据

根据多个条件更新数据

UPDATE sphwph SET BKXSHL=t2.BKXSHL
FROM sphwph t1,sphwph_170420 t2
--(SELECT a.* FROM  dbo.sphwph a JOIN spkfk b 
--ON a.spid = b.spid WHERE a.shl 0 AND a.hw='HWI00000001'
--AND a.spid IN(
--SELECT DISTINCT spid FROM dbo.jzorder_mx WHERE djbh = 'XSGZDA00095866'
--)) t2 
WHERE t1.hw=t2.hw AND t1.pihao=t2.pihao AND t1.spid=t2.spid

 

你可能感兴趣的:(SQL-根据多个条件更新数据)