将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

posted @ 2014-12-01 17:11  LuckyNick  阅读(170)  评论(0编辑  收藏  举报