mysql函数拼接查询concat函数的使用方法
来源:动视网
责编:小采
时间:2020-11-09 20:30:59
mysql函数拼接查询concat函数的使用方法
mysql函数拼接查询concat函数的使用方法:如下所示: //查询表managefee_managefee的年year 和 month ,用concat函数拼成year-month。例如将2017和1 拼成2017-01。. select CONCAT(a.year,'-',if(a.month<=9,CONCAT('0',a.month),a.month))as da
导读mysql函数拼接查询concat函数的使用方法:如下所示: //查询表managefee_managefee的年year 和 month ,用concat函数拼成year-month。例如将2017和1 拼成2017-01。. select CONCAT(a.year,'-',if(a.month<=9,CONCAT('0',a.month),a.month))as da

如下所示:
//查询表managefee_managefee的年year 和 month ,用concat函数拼成year-month。例如将2017和1 拼成2017-01。.
select CONCAT(a.year,'-',if(a.month<=9,CONCAT('0',a.month),a.month))as date,a.* from managefee_managefee as a;
//查询managefee_managefee中时间段为2017-01到2017-07的数据
select * from
(
select CONCAT(a.year,'-',if(a.month<=9,CONCAT('0',a.month),a.month))as date,a.* from managefee_managefee as a
) b
where b.date between '2017-01' and '2017-07';
以上这篇mysql函数拼接查询concat函数的使用方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持脚本之家。
您可能感兴趣的文章:
Mysql字符串截取函数SUBSTRING的用法说明MySQL replace函数替换字符串语句的用法mysql获取字符串长度函数(CHAR_LENGTH)MySQL里实现类似SPLIT的分割字符串的函数使用MySQL中的AVG函数求平均值的教程详解Mysql中的JSON系列操作函数Mysql中LAST_INSERT_ID()的函数使用详解Mysql数据库使用concat函数执行SQL注入查询MySQL笔记之函数查询的使用mysql 查询数据库中的存储过程与函数的语句MySQL使用集合函数进行查询操作实例详解
mysql函数拼接查询concat函数的使用方法
mysql函数拼接查询concat函数的使用方法:如下所示: //查询表managefee_managefee的年year 和 month ,用concat函数拼成year-month。例如将2017和1 拼成2017-01。. select CONCAT(a.year,'-',if(a.month<=9,CONCAT('0',a.month),a.month))as da