首页 > 数据库技术 > 详细

mysql CONCAT用法

时间:2018-05-19 17:34:40      阅读:244      评论:0      收藏:0      [点我收藏+]

1、全表查询

SELECT * FROM `wh_statistics_service_api_request`;

技术分享图片

由于上面时间是按year,month,day三个数值字段来存时间的,现在想通过时间段查询,可以用concat将三个字段拼接

SELECT CONCAT(t1.year,‘-‘,t1.month,‘-‘,t1.day) as accessDate, t1.total_request_count as accessCount FROM wh_statistics_service_api_request t1, wh_bu_service t2 where t1.service_id=t2.service_id  AND date(CONCAT(t1.year,‘-‘,t1.month,‘-‘,t1.day)) <date(‘2018-5-19‘);

技术分享图片

 

mysql CONCAT用法

原文:https://www.cnblogs.com/boshen-hzb/p/9060740.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!