mysql - SQL : I need to explode a string by ">" and want to remove the last thread and Replace the (-) by space in CamelCase

标签 mysql

我的字符串如下,我需要驼峰式大小写的输出,如下

For example:
compact-cameras>ixus>digital-ixus-160
compact-cameras>ixus>digital-ixus-160>DSLR
scanners>document-scanners>dr-6030c

Output:
Compact cameras>ixus
Compact Cameras>Ixus>Digital Ixus 160
Scanners>Document Scanner

最佳答案

您可以通过下面的语句删除字符串的最后一部分并删除“-”,然后使用提供的链接-- camel case function 中的驼峰式大小写函数。

SELECT REPLACE(REPLACE('compact-cameras>ixus>digital-ixus-160>DSLR',SUBSTRING_INDEX('compact-cameras>ixus>digital-ixus-160>DSLR','>',-1),''),'-',' ');

Is there a simple way to convert MySQL data into Title Case?

关于mysql - SQL : I need to explode a string by ">" and want to remove the last thread and Replace the (-) by space in CamelCase,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30889408/

相关文章:

MySQL - 通过时间戳进行查询是否更有效?

php - 最新访客

mysql - rails 。 MySQL。变量 'sql_mode'不能设置为 'STRICT_ALL_TABLES'的值

java - 在 Java 中连接到 MySQL 数据库时访问被拒绝

c# - 无法将 MySQL 日期/时间值转换为 VS2010 中的 System.DateTime

python - SQL 语句中并未使用所有参数,但我只想更新 1 列

php - CakePHP/Mysql 插入 UTF-8

mysql - 在 SQL 的另一列中提取具有指定公共(public)值的元组

php - 查询生成器 - 结合 orderBy 和 groupBy

mysql - Nodejs sequelize 如何截断外键引用表