![](/img/trans.png)
[英]MySql doing multiple counts with different where on the same table for the same user and updating
[英]Updating multiple field in same table with different WHERE condition in mysql
是否可以同時使用2個不同的where條件同時更新“ bincard”表中的“ QtyBalance”字段。 目前我正在使用2查詢是這樣的:
update `bincard` set `QtyBalance`= 80 where `BinId`= 65
update `bincard` set `QtyBalance`= 20 where `BinId`= 66
UPDATE `bincard` SET `QtyBalance` =
CASE
WHEN `BinId`= 65 THEN 80
WHEN `BinId`= 66 THEN 20
ELSE `QtyBalance`
END
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.