Tuesday, July 5, 2016

Change enum column value when matching condition

The example shows how to rename the existing enum value OLD_VALUE to NEW_VALUE. 

Example 1:
 UPDATE `userinfo` set `account_type` = 'Houseowner' where  
 `account_type` = 'dipen';  

Example 2:
 update userinfo set account_type = replace(account_type, 'normal', 'hello')  

Note: Your enum must contain new value otherwise your value will be replaced with empty value.

No comments:

Post a Comment