问答文章1 问答文章501 问答文章1001 问答文章1501 问答文章2001 问答文章2501 问答文章3001 问答文章3501 问答文章4001 问答文章4501 问答文章5001 问答文章5501 问答文章6001 问答文章6501 问答文章7001 问答文章7501 问答文章8001 问答文章8501 问答文章9001 问答文章9501

mysql 字符串处理

发布网友 发布时间:2022-04-23 18:56

我来回答

4个回答

热心网友 时间:2022-04-08 05:33

-- SQL语句//建立函数

DELIMITER $$

CREATE FUNCTION `DeleteStr`(str varchar(1000)) RETURNS varchar(1000)
BEGIN
set str = replace(str,'a','');
set str = replace(str,'b','');
set str = replace(str,'c','');
set str = replace(str,'d','');
set str = replace(str,'e','');
set str = replace(str,'g','');
set str = replace(str,'g','');
set str = replace(str,'h','');
set str = replace(str,'i','');
set str = replace(str,'j','');
set str = replace(str,'k','');
set str = replace(str,'l','');
set str = replace(str,'m','');
set str = replace(str,'n','');
set str = replace(str,'o','');
set str = replace(str,'p','');
set str = replace(str,'q','');
set str = replace(str,'r','');
set str = replace(str,'s','');
set str = replace(str,'t','');
set str = replace(str,'u','');
set str = replace(str,'v','');
set str = replace(str,'w','');
set str = replace(str,'x','');
set str = replace(str,'y','');
set str = replace(str,'z','');
set str = replace(str,'A','');
set str = replace(str,'B','');
set str = replace(str,'C','');
set str = replace(str,'D','');
set str = replace(str,'D','');
set str = replace(str,'F','');
set str = replace(str,'G','');
set str = replace(str,'H','');
set str = replace(str,'I','');
set str = replace(str,'J','');
set str = replace(str,'K','');
set str = replace(str,'L','');
set str = replace(str,'M','');
set str = replace(str,'N','');
set str = replace(str,'O','');
set str = replace(str,'P','');
set str = replace(str,'Q','');
set str = replace(str,'R','');
set str = replace(str,'S','');
set str = replace(str,'T','');
set str = replace(str,'U','');
set str = replace(str,'V','');
set str = replace(str,'W','');
set str = replace(str,'X','');
set str = replace(str,'Y','');
set str = replace(str,'Z','');
return str;
END;

$$

DELIMITER ;

-- 执行函数

select DeleteStr('123a321c546e64ef316ga131a16c646j')

热心网友 时间:2022-04-08 06:51

这个字段是数据库里的某个字段的值?还是PHP里的?
如果是PHP里的先正则替换下:
<?
preg_match_all("/\d/","123a321c546e64ef316ga131a16c646j", $matches);
print_r($matches);
echo implode($matches[0],'');
?>

热心网友 时间:2022-04-08 08:26

select translate('Abcce0133','0123456789',' ') from al;
Oracle的 有translate函数 mysql不知道有这个函数没有

热心网友 时间:2022-04-08 10:17

这个我不会,关注。
声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com
宝宝被蜱虫叮咬后怎么办? 宝宝被蜱虫咬后该怎么办? 宝宝被蜱虫咬了,要怎么办啊? 宝宝被蜱虫咬了该怎么办? 携程旅行飞机票怎么退 携程旅行退机票手续费介绍 苹果七用ios10.0.01为什么打字 翻照片都炒鸡卡?刚刚买了几天 而且是1... 苹果7怎么老是感觉一顿一顿的 有没有人把苹果手机系统换成ios10之后,老死 QQ会员怎样成为VIP2 Mysql数据库中海量字符串中如何快速查找那些具有公共的子串字符串... mysql字符串类型包括 梦见家里房子再建一个大门 梦见自已家大门换成了鬼门? 梦见家里的大门换了新的 怎样去除虾仁里的黑线 重庆如何更快速找到需要小额贷款的人! 重庆三快小额贷款骗了个人信息没事吧!已经三个月了,我怕拿我的个人信息去贷款? 重庆市分众小额贷款有限公司怎么样? 生活妙招:怎样轻松去除虾背上的黑线 环球怎么样 靠不靠谱。有用吗?能具体说说吗 重庆隆携小额贷款怎么样? 环球可以借款吗 环球怎么样,真可以贷款吗 来看看 哪些是坑人的重庆小额贷款公司 重庆小额贷款这个公司是不是真的? 我想借2000块钱,我是黑户,银行借不了,怎么办, 贷款,贷款怎么样安全吗,贷款app入口 你也被重庆小额贷款骗了吗? 小额贷款是哪个app mysql怎么查询某个字段里的字符串? mysql 字符串类型问题 mysql截取删除字符串 mysql 中用正则表达式如何取一个字符串中指定的字段, mysql字符串截取 MySql截取字符串 mysql的查询中怎么截取字符串? MySQL中的字符串比较 mysql 截取字符串 MySql中截取字符串中的某几个字符 mysql 字符串如何计算 美团包吃住吗? 美团送外卖怎么样 好不好啊 一个月能赚多少钱 还有包吃包住吗 外卖小哥包吃包住那吃在哪里吃吃是要自己付钱嘛? 郑州,美团外卖送餐员,包住不有没有宿舍啥的 怀化市跑美团包吃住吗? 请问做美团外卖在哪个城市好?工资待遇怎么样的呢?包吃住吗? 美团外卖包吃包住吗 美团外卖元工月结,武汉市的怎么算,包住哪? 在58同城上找工作很多说是美团直聘人事部的说要招人,工作八小时工作八千多包住靠不靠谱?