通过MYSQL查找字符串中括号之间的数据 [英] Looking to extract data between parentheses in a string via MYSQL

查看:1571
本文介绍了通过MYSQL查找字符串中括号之间的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以帮忙吗?我一直在搜索并遇到/修改了此代码,因此得到的结果为1或0. ()和(如果没有)之间为1,则为1.我正在寻找确切地找到他们之间的东西,如果没有的话.因此,如果我在一个字段中有一个看起来像这样的字符串:"ABC(989)Hello"当前我得到1作为结果,我想得到"989".任何帮助将不胜感激.

Can someone please help. I have been searching and encountered/modified this code I am getting a 1 or 0 as a result. 1 if there is something between () and 0 if there is not. I am looking to find exactly what is between them not if there is something. So if I have a string in afield that looks like this: "ABC (989) Hello" currently I get 1 as my result I would like to get "989". Any help would be greatly appreciated.

选择,OUTCNTCTNOTE正则表达式'[(] | \ \ [)]'作为测试 来自trcalls.callcoding;

select , OUTCNTCTNOTE regexp '[(]|\\[)]' as test from trcalls.callcoding;

推荐答案

select substr(columnname,instr(columnname,"(") + 1, instr(columnname,")")) as temp from mytable

接近,我对此进行了测试.请查看是否有帮助!

something close, I tested this. Please see if this helps!

这篇关于通过MYSQL查找字符串中括号之间的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆