Microsoft Access - Case Query Microsoft Access - Case Query sql sql

Microsoft Access - Case Query


There is no CASE ... WHEN in Access SQL. You can use the Switch Function instead.

UPDATE HAISET REGION = Switch(    NUMREG Like '*1', 'BDG',    NUMREG Like '*2', 'JKT',    NUMREG Like '*3', 'KNG'    );

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.

UPDATE HAISET REGION = Switch(    NUMREG ALike '%1', 'BDG',    NUMREG ALike '%2', 'JKT',    NUMREG ALike '%3', 'KNG'    );