3

Good Day,

I am trying to figure out how to update multiple columns in h2 database. Single column is easy like this:

UPDATE TABLENAME SET COLUMN1='X' WHERE ID='2'

But I want to update COLUMN2 and COLUMN3 also. How do i do this?!!

1 Answer 1

4

The regular syntax to update multiple columns is:

UPDATE TABLENAME 
SET COLUMN1='X', COLUMN2='Y', COLUMN3='Z' 
WHERE ID='2'

Some database also support:

UPDATE TABLENAME 
SET (COLUMN1, COLUMN2, COLUMN3) = 
('X', 'Y', 'Z') WHERE ID='2'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.