sql 数据库数据 批量判断修改

时间:2022-04-27 21:23:47

A表B表相关联  更新B表中的VisitWeek字段值

sql 数据库数据 批量判断修改

CCD_PartnerVisit 此为B表

Dell_FiscalWeek  此为A表

UPDATE CCD_PartnerVisit SET
VisitWeek = 'FY'+convert(varchar(50),Dell_FiscalWeek.Fiscal_Year)+'Q'+convert(varchar(50),Dell_FiscalWeek.Fiscal_Quarter)+'W'+convert(varchar(50),Dell_FiscalWeek.Fiscal_QuarterWeek)
FROM CCD_PartnerVisit,Dell_FiscalWeek
WHERE CCD_PartnerVisit.VisitDate = Dell_FiscalWeek.C_Date