We are told to watch out for things being set to null (we dont want) by using the IN clause in the following:
UPDATE Tests SET
TestScore =
CASE
WHEN TestId = 10 THEN 1000
WHEN TestId = 11 THEN 1100
END,
TestScore2 =
CASE
WHEN TestId = 10 THEN 2000
WHEN TestId = 11 THEN 2100
END
WHERE TestId IN (10, 11)
But what happens when there two conditions required, namely the joint combo of (TestId, TestSubId)? Ie, what do I do for the IN clause, the ???, in the following to show it has to be in the combos (10,25) and (11,22):
UPDATE Tests SET
TestScore = CASE
WHEN (TestId = 10 AND TestSubId = 25) THEN 1000
WHEN (TestId = 11 AND TestSubId = 22) THEN 1100
END,
TestScore2 = CASE
WHEN (TestId = 10 AND TestSubId = 25) THEN 2000
WHEN (TestId = 11 AND TestSubId = 22) THEN 2100
END
WHERE TestId, TestSubId IN ?????