MySQL选择带有多个特殊字符的字符串 [英] MySQL selecting string with multi special characters

查看:52
本文介绍了MySQL选择带有多个特殊字符的字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在从数据库中选择字符串时遇到问题.问题是,如果您在行中有 +(123)-4 56-7 并且使用字符串 1234567 进行搜索,则不会找到任何结果.有什么建议吗?

I'm having a problem selecting strings from database. The problem is if you have +(123)-4 56-7 in row and if you are searching with a string 1234567 it wouldn't find any results. Any suggestions?

推荐答案

使用替换函数查询 -

Query using replace function as -

select * from phoneTable where replace(replace(replace(phone, '+', ''), '-', ''), ')', '(') LIKE '%123%'

这篇关于MySQL选择带有多个特殊字符的字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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