in case when else end the update

- When the value mark_way field is 'allocated land' to modify the value of this field to '00'
- when the value of 'transfer land' mark_way field to modify the field value is '01'
- or to the field modify the value '

Update ais_clsland A 
 SET a.mark_way = ( the CASE  the WHEN a.mark_way = ' allocated land '  THEN  ' 00 '  
the WHEN a.mark_way = ' transfer land '  THEN  ' 01 '  
the ELSE  ''  the END )

 


 

UPDATE `fwdata-prd-v2`.barcode_sn_record a 
SET 
    a.color = (CASE
        WHEN a.color = 'red' THEN '红色'
        WHEN a.color = 'blue' THEN '蓝色'
        WHEN a.color = 'green' THEN '绿色'
        WHEN a.color = 'yellow' THEN '黄色'
        WHEN a.color = 'double' THEN '黄绿双色'
        ELSE ''
    END)
WHERE
    color IN ('red' , 'blue', 'green', 'yellow', 'double');

  

Guess you like

Origin www.cnblogs.com/yuhuameng/p/11563067.html