179 UPDATE dbo.TestStudents SET LASTNAME = ( CASE WHEN (LASTNAME = 'AAA') THEN 'BBB' WHEN (LASTNAME = 'CCC') THEN 'DDD' WHEN (LASTNAME = 'EEE') THEN 'FFF' ELSE (LASTNAME) END ) 该语句出于该目的而工作,但else条件遍历表中的每个记录。有什么办法可以让未受影响的行保持原样? sql sql-server tsql sql-update — 用户名 source
336 添加WHERE子句 UPDATE dbo.TestStudents SET LASTNAME = CASE WHEN LASTNAME = 'AAA' THEN 'BBB' WHEN LASTNAME = 'CCC' THEN 'DDD' WHEN LASTNAME = 'EEE' THEN 'FFF' ELSE LASTNAME END WHERE LASTNAME IN ('AAA', 'CCC', 'EEE') — 吴宇森 source