摘要: 按周 select DATE_FORMAT(create_time,'%Y%u') weeks,count(caseid) count from tc_case group by weeks; 按月 select DATE_FORMAT(create_time,'%Y%m') months,coun 阅读全文
posted @ 2018-06-22 15:50 任飞儿 阅读(2488) 评论(1) 推荐(1) 编辑
摘要: SELECT * FROM table_name WHERE to_days(createtime) = to_days(now()); SELECT * FROM table_name WHERE YEARWEEK(date_format(createtime,'%Y-%m-%d')- INTER 阅读全文
posted @ 2018-06-22 15:49 任飞儿 阅读(2319) 评论(1) 推荐(0) 编辑
摘要: mysql查询今天、昨天、上周 今天 select * from 表名 where to_days(时间字段名) = to_days(now()); 昨天 SELECT * FROM 表名 WHERE TO_DAYS( NOW( ) ) - TO_DAYS( 时间字段名) <= 1 7天 SELEC 阅读全文
posted @ 2018-06-22 15:17 任飞儿 阅读(10287) 评论(1) 推荐(0) 编辑
摘要: select id, phone,time,year(time),month(time), DAY(time),TIME(time) from user where phone='xxxxxx' #分别取年、月、日、时间select id, phone,time from user where ph 阅读全文
posted @ 2018-06-22 15:07 任飞儿 阅读(5164) 评论(0) 推荐(0) 编辑