Reputation: 31
I am trying to run an update query that modifies the entry in a field via two statements. I keep getting a syntax error 1064 in Workbench. If I run each statement separately in two different queries, they both work. What I want is for both statements to be in one single query but I keep getting the 1064 error. The code is below.
UPDATE `tbloldfurniture`
SET `tbloldfurniture`.`NotesOnOldness` = UPPER(`NotesOnOldness`),
SET `tbloldfurniture`.`NotesOnOldness` = TRIM(`NotesOnOldness`)
WHERE rwID = 3;
What am I doing wrong? The full error message is below:
Error Code: 1064. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SET `tbloldfurniture`.`NotesOnOldness` = LOWER(`NotesOnOldness`) WHERE rwID = 3' at line 4
Thanks.
Upvotes: 0
Views: 70
Reputation: 780724
It should be:
UPDATE `tbloldfurniture`
SET `tbloldfurniture`.`NotesOnOldness` = TRIM(UPPER(`NotesOnOldness`))
WHERE rwID = 3;
If you want to set multiple columns, you separate the assignments only with ,
, you don't repeat the word SET
before each. But in this case you're only setting one column, so you don't need two assignments. Just nest the function calls in a single expression.
Upvotes: 1