I have a table which I'm trying to update the cells of based on multiple where clauses, but it's failing and I don't understand why. Can anyone look at this and help?
| UserID | Options | Sub_option | Parameters |
|---|---|---|---|
| 1 | Name | Firstname | Rick |
| 1 | Name | Lastname | James |
| 1 | Autoreply | 0 | |
| 1 | Autosignature | 0 | |
| 2 | Name | Firstname | Rick |
| 2 | Name | Lastname | Astley |
| 2 | Autoreply | 0 | |
| 2 | Autosignature | 1 |
UPDATE Our_users
SET Parameters = CASE
WHEN UserID = '2' AND Options = 'MAIL' AND Sub_option = 'Autoreply' THEN '1'
WHEN UserID = '2' AND Options = 'MAIL' AND Sub_option = 'Autosignature' THEN '0'
END
When running this, it seems to update "Parameters" for all rows. Can't I use "AND" in WHEN clause?