Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

setting multiple column using one update

Tags:

mysql

People also ask

How do you UPDATE multiple columns with multiple conditions?

To update multiple columns use the SET clause to specify additional columns. Just like with the single columns you specify a column and its new value, then another set of column and values. In this case each column is separated with a column.

Can we UPDATE multiple columns in a single UPDATE statement in Oracle?

Note that the UPDATE statement allows you to update as many columns as you want.

Can you do multiple sets in SQL UPDATE?

Can we UPDATE multiple tables with a single SQL query? No, only 1 table can be updated with an UPDATE statement. However, you can use a transaction to ensure that 2 or more UPDATE statements are processed as a single unit-of-work.

Can we UPDATE multiple columns in a single UPDATE statement in MySQL?

MySQL UPDATE command can be used to update multiple columns by specifying a comma separated list of column_name = new_value. Where column_name is the name of the column to be updated and new_value is the new value with which the column will be updated.


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'