首页 > 代码库 > 将A行数据更新成B行数据

将A行数据更新成B行数据

UPDATE D SET InPrice = A.InPrice, ClinPrice = A.ClinPrice
FROM
hisdb..BASE_MedBatch A
INNER JOIN hisdb..BASE_Dept C ON A.HospitalID = C.HospitalID AND C.DeptID = A.DeptID
INNER JOIN hisdb..BASE_MedBatch D ON A.HospitalID = D.HospitalID AND A.StockID = D.StockID AND D.Batch = A.Batch AND D.BatchNo = A.BatchNo
WHERE
C.Drug = 1
AND A.CreateTime > ‘2014-10-30‘
AND A.InPrice <> D.InPrice

将A行数据更新成B行数据