mysql case when then 语法

UPDATE table_name 
SET feild1 =
CASE
        
        WHEN feild1 = '0' THEN
        'xxx0' 
        WHEN feild1 = '1' THEN
        'xxx1' 
        WHEN xxx_type = '2' THEN
        'xxx2' 
    END,
    feild2 =
CASE
        
        WHEN feild2 = '0' THEN
        'xxx0' 
        WHEN feild2 = '1' THEN
        'xxx1' 
        WHEN xxx_type = '2' THEN
        'xxx2' 
    END,
    
WHERE
    condition1 = xxx

 

posted @ 2019-08-15 16:57  new_boys  阅读(2148)  评论(0编辑  收藏  举报