Skip to content

update修改数据的问题

UPDATE DAS_xe_srqk SET gzxsr = COALESCE(gzxsr, 0), scjyxsr = COALESCE(scjyxsr, 0), scjyxzc = COALESCE(scjyxzc, 0), ccxsr = COALESCE(ccxsr, 0), jhsyj = COALESCE(jhsyj, 0), dbj = COALESCE(dbj, 0), ylbxj = COALESCE(ylbxj, 0), stbcj = COALESCE(stbcj, 0), tkgyj = COALESCE(tkgyj, 0), qtzyxsr = COALESCE(qtzyxsr, 0), sysr = COALESCE(sysr, 0), dlgsr= COALESCE(dlgsr, 0);

-- data.zyxsrhj = Number((data.jhsyj + data.dbj + data.ylbxj + data.stbcj + data.tkgyj + data.qtzyxsr + data.sysr).toFixed(2)); update DAS_xe_srqk SET zyxsrhj=jhsyj +dbj + ylbxj + stbcj + tkgyj + qtzyxsr + sysr;

-- data.jtzsr = Number((data.gzxsr + data.scjyxsr - data.scjyxzc + data.ccxsr + data. zyxsrhj).toFixed(2))

update DAS_xe_srqk SET jtzsr=gzxsr+scjyxsr-scjyxzc+ccxsr+zyxsrhj;

-- data.jtrjcsr = Number((data.jtzsr/data.jtrks).toFixed(2))

update DAS_xe_srqk s inner join DAS_householdcode_xe x on s.hid=x.id SET s.jtrjcsr = s.jtzsr/IF(COALESCE(x.jtrks, 0) = 0, 1, x.jtrks);