我如何结合这两个更新语句:) }5 ?1 P# r- k' u) J
update Special_quota set Status=0,Additional_msg_quota=0 where User_id not in('1','2','3') - D; d( v9 h7 E( D- j* tupdate Special_quota set Status=1,Additional_msg_quota=30 where User_id in('1','2','3')/ C. r+ m/ c" m2 l' C9 [
+ N- H4 k1 S7 N9 }" H0 g' A( J解决方案: + n- P h _0 p. Z8 V ' w; x9 `+ L& W1 o7 R4 x
% \" W2 d7 x' A5 y0 M8 q+ W: @+ E 1 b. D! z! m4 G: ?1 h( U/ U 您可以使用CASE表达式,如下所示: * C* ]" f2 z" X+ n6 xUPDATE Special_quota ) t- ?5 e: K- @/ G
set Status = CASE WHEN User_ID IN('1','2','3') then 1 else 0 end, ( G' @8 O7 ?# S3 j additional_msg_quota = CASE WHEN User_ID IN('1','2','3') then 30 else 0 end