开发者

mysql update script problem. all txt is lower case just first letter is upper case

开发者 https://www.devze.com 2023-04-01 04:42 出处:网络
This are my text in mysql datab开发者_如何学Case. Otok Pasman, Kraj Otok pasman,Kraj Otok Pasman , Kraj

This are my text in mysql datab开发者_如何学Case.

Otok Pasman, Kraj
Otok pasman,Kraj
Otok Pasman , Kraj
Otok pasman, Kraj
Otok PASMAN, Kraj

How can i automatically change all rows to lower case, first letter must be upper case and " , " is always ", "?

so like this:

Otok Pasman, Kraj

and all other text in database like this example?


something like this should work:

UPDATE `table` 
SET `field` = REPLACE(CONCAT(UPPER(LEFT(`field`, 1)), LOWER(SUBSTRING(`field`, 2))),' , ', ', ')
0

精彩评论

暂无评论...
验证码 换一张
取 消