MySQL截取字符串函数方法
来源:互联网 发布:linux 查看磁盘阵列 编辑:程序博客网 时间:2024/04/30 02:48
函数:
1、从左开始截取字符串
left(str, length)
说明:left(被截取字段,截取长度)
例:select left(content,200) as abstract from my_content_t
2、从右开始截取字符串
right(str, length)
说明:right(被截取字段,截取长度)
例:select right(content,200) as abstract from my_content_t
3、截取字符串
substring(str, pos)
substring(str, pos, length)
说明:substring(被截取字段,从第几位开始截取)
substring(被截取字段,从第几位开始截取,截取长度)
例:select substring(content,5) as abstract from my_content_t
select substring(content,5,200) as abstract from my_content_t
(注:如果位数是负数 如-5 则是从后倒数位数,到字符串结束或截取的长度)
4、按关键字截取字符串
substring_index(str,delim,count)
说明:substring_index(被截取字段,关键字,关键字出现的次数)
例:select substring_index(”blog.chinabyte.com”,”。”,2) as abstract from my_content_t
结果:blog.chinabyte
(注:如果关键字出现的次数是负数 如-2 则是从后倒数,到字符串结束)
结果:chinabyte.com
- MySQL截取字符串函数方法
- MySQL截取字符串函数方法
- MySQL 字符串截取函数
- Mysql字符串截取函数
- MySQL截取字符串函数
- MySQL 字符串截取函数
- MySQL 字符串截取函数
- mysql 字符串截取函数
- MySQL 字符串截取函数
- MySQL 字符串截取函数
- MySQL 字符串函数:字符串截取
- MySQL 字符串函数:字符串截取
- MySQL 字符串函数:字符串截取
- MySQL 字符串函数:字符串截取
- MySQL 字符串函数:字符串截取
- MySQL 字符串函数:字符串截取
- MySQL字符串函数:字符串截取
- MySQL字符串函数:字符串截取
- Ajax中Get请求与Post请求的区别
- 屏幕适配技术查阅资料汇总
- 2.6下多文件内核模块的makefiel编写
- 使用LFM(Latent factor model)隐语义模型进行Top-N推荐
- iphone使用开源代码Asyncsocket进行socket编程
- MySQL截取字符串函数方法
- 由CSDN论坛的文件缓存想到的(http://www.csharpwin.com/dotnetspace/2329.shtml)
- Flash编程
- Run-Time Check Failure
- mongoDB $inc用法
- 学习linux
- Servlet容器Filter的使用(Filter解决乱码问题实例)
- 实现设计模式:观察者模式
- Linux内核中的PAE意义