使用一次更新设置多列


197

如何在MySQL中使用更新查询设置表的多个列?

Answers:


338

只需添加参数,并以逗号分隔即可:

UPDATE tablename SET column1 = "value1", column2 = "value2" ....

另请参阅:有关更新的mySQL手册


1
是否可以在两列的末尾添加where子句?
71GA

@ 71GA我不这么认为。听起来您需要两个不同的语句。
Pekka

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.