我有下面的查询,它不工作。我做错了什么?这可能吗?
UPDATE ProductReviews AS R
INNER JOIN products AS P
ON R.pid = P.id
SET R.status = '0'
WHERE R.id = '17190'
AND P.shopkeeper = '89137'
我有下面的查询,它不工作。我做错了什么?这可能吗?
UPDATE ProductReviews AS R
INNER JOIN products AS P
ON R.pid = P.id
SET R.status = '0'
WHERE R.id = '17190'
AND P.shopkeeper = '89137'
当前回答
UPDATE R
SET R.status = '0'
FROM dbo.ProductReviews AS R
INNER JOIN dbo.products AS P
ON R.pid = P.id
WHERE R.id = '17190'
AND P.shopkeeper = '89137';
其他回答
这应该做到:
UPDATE ProductReviews
SET ProductReviews.status = '0'
FROM ProductReviews
INNER JOIN products
ON ProductReviews.pid = products.id
WHERE ProductReviews.id = '17190'
AND products.shopkeeper = '89137'
UPDATE R
SET R.status = '0'
FROM dbo.ProductReviews AS R
INNER JOIN dbo.products AS P
ON R.pid = P.id
WHERE R.id = '17190'
AND P.shopkeeper = '89137';