时间:2021-04-11 08:56:44 | 栏目:Mysql | 点击:次
如下所示:
//查询表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';