MySql

mysql 更新替换字段

2023-01-31  本文已影响0人  Rinaloving

更新替换字段中某个值

1. 操作

UPDATE  `TbTaskItem` SET sCode =  CONCAT("SR",REPLACE(sCode,'AU',''))  WHERE pkid=1596
QQ截图20230131152941.png
UPDATE  `TbTaskItem` SET sCode = (CASE WHEN  sCode LIKE '%AU%' THEN CONCAT('SR',REPLACE(sCode,'AU','')) ELSE sCode  END )  WHERE pkid=1596;
QQ截图20230131163255.png

2. 补充

SELECT nState,CASE  WHEN nState =2 THEN '支付失败' WHEN nState=3 THEN '已支付' ELSE '' END AS SState FROM TbRewardRecord 
QQ截图20230201171159.png
上一篇下一篇

猜你喜欢

热点阅读