如下所示: //查询表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
如下所示:
//查询表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函数的使用方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持每日运维。