mysql函数拼接查询concat函数的使用方法
时间: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';
上一篇:mysql ERROR 1044 (42000): Access denied for user ''@'localhost' to database
栏 目:Mysql
本文地址:http://www.codeinn.net/misctech/99089.html