开发者

setting multiple column using one update

开发者 https://www.devze.com 2023-01-15 12:20 出处:网络
How to set multiple columns of a table using u开发者_开发问答pdate query in mysql?Just add parameters, split by comma:

How to set multiple columns of a table using u开发者_开发问答pdate query in mysql?


Just add parameters, split by comma:

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

See also: mySQL manual on UPDATE


UPDATE some_table 
   SET this_column=x, that_column=y 
   WHERE something LIKE 'them'


Let's take an example where you have a people table and you would like to update the age and the name column for the person with id equals to 5. The query will look like this:

UPDATE people SET age = 34, name = "John" WHERE id = 5
0

精彩评论

暂无评论...
验证码 换一张
取 消