字符串截取mysql
2017-05-26 --SUBSTR(addtime, 1, 10)
--substr(string string,num start,num length);
--string为字符串
--start为起始位置
--length为长度 SELECT d.uid,
SUBSTR(u.addtime, 1, 10) as 注册时间,
d.cid as cid
FROM user_extra_device d,
user u
where d.uid= u.id
and u.addtime>= "2017-01-09 00:00:00"
order by SUBSTR(u.addtime, 1, 10) --从左边开始截取3个字符
select left('example.com', 3)
--结果exa --从右边开始截取3个字符
select right('example.com', 3) --从字符串的第 4 个字符位置开始取,直到结束
select substring('example.com', 4)
--mple.com --从字符串的第 4 个字符位置开始取,只取 2 个字符
select substring('example.com', 4, 2) --从字符串的第 4 个字符位置(倒数)开始取,直到结束
select substring('example.com', -4)
--.com --从字符串的第 4 个字符位置(倒数)开始取,只取 2 个字符
select substring('example.com', -4, 2)
字符串截取mysql的更多相关文章
- MySQL字符串函数substring:字符串截取
MySQL 字符串截取函数:left(), right(), substring(), substring_index().还有 mid(), substr().其中,mid(), substr() ...
- MySQL substring:字符串截取 (转载)
MySQL 字符串截取函数:left(), right(), substring(), substring_index().还有 mid(), substr().其中,mid(), substr() ...
- mysql字符串截取
mysql字符串截取 update zcat ) where lev1 is null; update zcat ) where lev2 is null; 函数: 1.从左开始截取字符串 left( ...
- MySQL 字符串截取相关函数
MySQL 字符串截取相关函数 在工作中,可能需要将某些字段按某个分割符组成一个字符串作为字段值存取到数据库表中,比如某个任务对应三个结果,分别存储在不同的数据表中,这时可以将这三个不同表的主键按照约 ...
- Mysql字符串截取函数SUBSTRING的用法说明
感觉上MySQL的字符串函数截取字符,比用程序截取(如PHP或JAVA)来得强大,所以在这里做一个记录,希望对大家有用. 函数: 1.从左开始截取字符串 left(str, length) 说明:le ...
- Mysql字符串截取总结:left()、right()、substring()、substring_index()
同步首发:http://www.yuanrengu.com/index.php/20171226.html 在实际的项目开发中有时会有对数据库某字段截取部分的需求,这种场景有时直接通过数据库操作来实现 ...
- MySQL 字符串截取SUBSTRING()函数
MySQL 字符串截取相关函数: 1.从左开始截取字符串 left(str, length) 说明:left(被截取字段,截取长度) 例: select left(content,200) as ab ...
- MySQL 字符串截取函数
MySQL 字符串截取函数:left(), right(), substring(), substring_index().还有 mid(), substr().其中,mid(), substr() ...
- MySQL字符串函数:字符串截取
MySQL 字符串截取函数:left(), right(), substring(), substring_index().还有 mid(), substr().其中,mid(), substr() ...
随机推荐
- day52 js--- bom dom
本文转载自李文周博客,-----cnblog.liwenzhou.com dom官网资料: http://www.w3school.com.cn/htmldom/dom_methods.asp Jav ...
- StringBuffer 可变参数拼接
@RequestMapping(value="/getFundsCount",method=RequestMethod.POST) public Result getFundsCo ...
- Codeforces 862D. Mahmoud and Ehab and the binary string 【二分】(交互)
<题目链接> 题目大意: 有一个长度为n(n<1000)的01串,该串中至少有一个0和一个1,现在由你构造出一些01串,进行询问,然后系统会给出你构造的串与原串的 Hamming ...
- HDU 3639 Hawk-and-Chicken (强连通缩点+DFS)
<题目链接> 题目大意: 有一群孩子正在玩老鹰抓小鸡,由于想当老鹰的人不少,孩子们通过投票的方式产生,但是投票有这么一条规则:投票具有传递性,A支持B,B支持C,那么C获得2票(A.B共两 ...
- cmd使用notepad++为打开方式打开文件
想放一个txt进入vstart中,但是又不想用系统自带的记事本打开,想在vstart中双击时使用notepad++打开. cmd命令如下: "D:\notepad++\notepad++.e ...
- 关闭VS2015的WPF UI调试工具
VS菜单: 工具 > 选项 > 调试 > 常规 > 启用Xaml 的UI调试工具.把勾勾去掉.
- 搭建vue脚手架---vue-cli
vue-cli作为一款mvvm框架语言(vue)的脚手架,集成了webpack环境及主要依赖,对于项目的搭建.打包.维护管理等都非常方便快捷.我们在开发项目时尤其需要这样一个快速构建项目的工具. 以下 ...
- skatebroads
skateboardsn.滑板( skateboard的名词复数 ) == skateboard英 [ˈskeɪtbɔ:d] . 斯给特博得. 美 [ˈskeɪtbɔ:rd] n.滑板复数: ska ...
- cout endl in c++
#include<iostream> using namespace std; int main() { cout<<endl; endl(cout); getchar(); ...
- mongodb副本集搭建
1.创建目录 mkdir -p /data/r1 /data/r2 /data/r3 2.启动: bin/mongod --config ../mongod.conf --replSet r1 b ...