我需要执行如下所示的查询,其中包含一个数据集。
UPDATE <OrderDataset>
SET FKProduct = P.PKProduct
FROM <OrderDataset> DS
INNER JOIN tblCustomer C ON DS.FKCustomer = C.PKCustomer
INNER JOIN tblProduct P ON C.PKCustomer = P.FKCustomer
INNER JOIN tblStock S ON S.FKProduct = P.PKProduct
AND DS.RotationNumber = S.RotationNumber
AND ISNULL(DS.RotationLineNo,'NULL') = ISNULL(S.RotationLineNo,'NULL')
WHERE DS.FKProduct IS NULL
有没有办法实现这一点。