删除 MySQL 中字符串的第一部分
我想删除字符串的第一部分和分隔字符串的逗号。
当前生成数据的代码:
SELECT PrizeMoneyBreakDown from race2;
SELECT
SUBSTRING_INDEX((SUBSTRING_INDEX(PrizeMoneyBreakDown,';',1)),';',-1) AS 1st,
FROM race2
数据:
1st,4000
1st,4550
1st,4550
1st,4550
1st,4550
期望的输出:
4000
4550
4550
4550
4550
I would like to remove the first part of the string and the comma that seperates the string.
Current code that produces data:
SELECT PrizeMoneyBreakDown from race2;
SELECT
SUBSTRING_INDEX((SUBSTRING_INDEX(PrizeMoneyBreakDown,';',1)),';',-1) AS 1st,
FROM race2
Data:
1st,4000
1st,4550
1st,4550
1st,4550
1st,4550
Desired output:
4000
4550
4550
4550
4550
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
以下查询将取字符串的第 5 个字符直到末尾:
Demo< /a>
或者使用您的方法,将
;
更改为;
并1
到-1
以获取字符串的第二部分The following query will take the 5-th character of the string till the end :
Demo
Or using your method, change the
;
with;
and1
to-1
to take the second part of the string