mysql 去除双引号
概念这里使用TRIM 函数去除双引号,这里的both 函数指去除目标,可以是双引号,也可以是其它的目标内容。1.使用trim 函数去除双引号2.BOTH 要去除对象3.FROM 要去除目标字段值实例:没去除之前SELECT username as 姓名 FROM user WHERE id='9'去除之后SELECT TRIM(BOTH '"' FROMusername) as 姓名 FROM u
·
概念
这里使用TRIM 函数去除双引号,这里的both 函数指去除目标,可以是双引号,也可以是其它的目标内容。
1.使用trim 函数去除双引号
2.BOTH 要去除对象
3.FROM 要去除目标字段值
实例:
没去除之前
SELECT username as 姓名 FROM user WHERE id='9'
去除之后
SELECT TRIM(BOTH '"' FROM username) as 姓名 FROM user WHERE id='9'
对json数据去除双引号
平常的json数据在查询出来的时候 是有双引号的
例:
第一种:
select JSON_EXTRACT(password, '$.applCde') as applCde,JSON_EXTRACT(password, '$.applyAmt') as applyAmt from user where id='9'
使用TRIM函数去除双引号之后
例:
select TRIM(BOTH '"' FROM JSON_EXTRACT(password, '$.applCde')) as applCde,JSON_EXTRACT(password, '$.applyAmt') as applyAmt from user where id='9'
第二种:
select TRIM(BOTH '"' from `password`->'$.applCde') as num from user WHERE id='9'
第三种:
直接获取
通过JSON_UNQUOTE 获取的json数据是不带双引号的
select JSON_UNQUOTE(`password`->'$.applCde') as num FROM user where id='9';
第四种:
select `password`->>'$.applCde' as num from user where id='9'
更多推荐
已为社区贡献1条内容
所有评论(0)