Reputation: 1175
Col1 . . . . .Col2
AA
BB
CC
AA
BB
CC
I need to update Col2, keeping in mind following conditions.
If Col1 = AA, then Col2 = A
If Col1 = BB, then Col2 = B
If Col1 = CC, then Col2 = C
I went through Build option and in functions, could see, IIF, Switch, and Choose, but can't understand how can I use them, for constructing a query, with multiple criteria.
Thanks for time.
Upvotes: 2
Views: 161
Reputation: 31239
You could do this:
UPDATE table1
SET Col2=
(
Switch
(
Col1 = 'AA', 'B',
Col1 = 'BB', 'B',
Col1 = 'CC', 'C',
true,'Unknowed'
)
)
Reference:
Upvotes: 1