SQL在第二个逗号之后获取字符串
我有这样的字符串:
'ing。 ,Jožko,Mrkvička,bc。'
,我只需要:
'Mrkvička'
谢谢。
I have string like this:
'Ing. , Jožko, Mrkvička, Bc.'
and I need just:
'Mrkvička'
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
不是最干净的解决方案。但是可以这样完成,
它将为您提供所需的输出
Not the cleanest solution. But it can be done like this
It will give you your desired output
在mysql中:
in mysql:
You can try with the following query:
The
尝试
该解决方案适用于SQL Server。
You can try with the following query:
The
STRING_SPLIT
function will split your string on the delimiter of your choice (,
), then the results are ordered on the rank using theROW_NUMBER
window function and limited at only one result withTOP 1
.Try it here.
This solution works for SQL Server.
对于PostgreSQL:
For PostgreSQL:
我希望按下以下
输入:
输出:
此解决方案适用于PostgreSQL。
I would prefer doing a regex as below
Input :
Output :
This solution works for PostgreSQL.