SQLitening Support Forum

SQLitening Support => You've got Questions? We've got Answers! => Topic started by: Bern Ertl on January 16, 2009, 04:35:08 pm

Title: Update two fields on same record with one statement?
Post by: Bern Ertl on January 16, 2009, 04:35:08 pm
I'd like to update two fields of the same record with one statement.  Right now, I'm using two SQL statements:

UPDATE table SET field1 = 'value1' WHERE RowID = 1

UPDATE table SET field2 = 'value2' WHERE RowID = 1

I'm guessing there is a better way to do this with just one SQL statement, right?
Title: Re: Update two fields on same record with one statement?
Post by: Fred Meier on January 16, 2009, 04:49:16 pm
see http://www.sqlite.org/lang_update.html

UPDATE table SET field1 = 'value1', field2 = 'value2' WHERE RowID = 1