更新多个值 Mysql

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1662180/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 14:24:38  来源:igfitidea点击:

Updating multiple values Mysql

sqlmysql

提问by streetparade

How can i update multiple values in mysql , this didn't work

我如何更新 mysql 中的多个值,这不起作用

 UPDATE test SET list=0,
price= 0.00 cprice= 0.00 WHERE test.id =3232

回答by northpole

you need to put a comma between the two different values. For example:

您需要在两个不同的值之间放置一个逗号。例如:

UPDATE orders 
   SET listPrice = 0
     , bloggerPrice = 0.00
     , customerPrice = 0.00 
WHERE orders.id =245745

回答by Greg

You're missing a comma:

你少了一个逗号:

UPDATE orders SET 
    listPrice = 0, 
    bloggerPrice = 0.00, 
    customerPrice = 0.00 
WHERE 
    orders.id = 245745

回答by James

Try:

尝试:

UPDATE orders 
SET listprice=0, bloggerPrice=0.00, customerPrice=0.00 
WHERE id=245745