更新条件に副問い合わせを使う
UPDATE Products SET Price = Price * 1.01 WHERE ProductID IN ( SELECT ProductID FROM Sales GROUP BY ProductID HAVING SUM( Quantity ) > 100 ) ;
SELECTの時の副問い合わせと特に変わることはないので難しくはありません。
UPDATE Products SET Price = Price * 1.01 WHERE ProductID IN ( SELECT ProductID FROM Sales GROUP BY ProductID HAVING SUM( Quantity ) > 100 ) ;
SELECTの時の副問い合わせと特に変わることはないので難しくはありません。