I've just try using MS Access 2007 now I want to update a column based on other column value, in MY SQL it was successfull running this query
UPDATE HAI
SET REGION=(
CASE
WHEN (NUMREG LIKE '%1') THEN 'BDG'
WHEN (NUMREG LIKE '%2') THEN 'JKT'
WHEN (NUMREG LIKE '%3') THEN 'KNG'
END);
This query won't run in MS Access, there is error Sytax error (missing operator) in query expression
. How can I solve this?
There is no CASE ... WHEN in Access SQL. You can use the Switch Function instead.
That query uses Access' default (ANSI 89 mode) * instead of % wildcard character. If you want to use the % wildcard, you can do it with the ALike comparison operator.