根据条件更新 table 和设置列
UPDATE table and SET column based on condition
这是我的代码现在的样子:
$stmt = $link->prepare("UPDATE product SET product_price_lowest = $adPrice WHERE product_id = $prodId");
$stmt->execute();
我想 SET product_price_lowest TO $adPrice only:
IF $adPrice < product_price_lowest
我该怎么做?
然后将其添加到 WHERE
子句以及
WHERE product_id = $prodId
AND $adPrice < product_price_lowest
这是我的代码现在的样子:
$stmt = $link->prepare("UPDATE product SET product_price_lowest = $adPrice WHERE product_id = $prodId");
$stmt->execute();
我想 SET product_price_lowest TO $adPrice only:
IF $adPrice < product_price_lowest
我该怎么做?
然后将其添加到 WHERE
子句以及
WHERE product_id = $prodId
AND $adPrice < product_price_lowest