Hi guys and good weekend for all.
I can not working this query update with CASE WHEN… What is wrong in this syntax?
I hope your appreciated help.
Saludos!
UPDATE tbl_upd t
JOIN(
SELECT
(
FIRST SELECT
...) + (LAST SELECT ...) output1)output2
SET CASE
WHEN LENGTH(strVariables)= 2 THEN
t.FieldUpdate1 = output2.output1
WHERE
xCodes = CONCAT(strVariables, '12')
ELSE
t.FieldUpdate2 = output2.output1
WHERE
xCodes = strVariables
END;
[Err] 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 'CASE WHEN
LENGTH(strVariables) = 2 THEN t.FieldUpdate1 = output2.output1 WHERE ' at line 41