1

I am trying to swap the value from m to f, while executing following query, Getting Syntax error

UPDATE GenderSET sex = CASE sex WHEN 'm' THEN 'f' ELSE 'm' END
2
  • If sex is 'm', you want it to display 'f'? if it's not 'm' you want to display 'm'?? Commented Jun 11, 2015 at 11:04
  • I wants vice versa, m to 'f' and f to 'm' Commented Jun 11, 2015 at 20:10

1 Answer 1

3

CASE ... WHEN is not supported in Access SQL. You can use an IIf expression instead.

UPDATE Gender SET sex = IIf(sex = 'm', 'f', 'm')
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.