How to combine two update queries having different where condition

后端 未结 2 852
名媛妹妹
名媛妹妹 2021-02-06 19:41

How can I combine this two update statements :

update Special_quota set Status=0,Additional_msg_quota=0 where User_id not  in(\'1\',\'2\',\'3\') 

update Special         


        
2条回答
  •  囚心锁ツ
    2021-02-06 20:28

    UPDATE Special_quota
    set Status = CASE WHEN User_ID IN('1','2','3') then 1 else 0 end,
        Additional_msg_quota = CASE WHEN User_ID IN('1','2','3') then 30 else 0 end
    

提交回复
热议问题