标签:mat int rom rdate 查询 alt csdn http 业务
统计各机型最近7天bug数量来支撑一张图表:
sql需要查询最近七天数据并按每天和机型进行分组
select * from table where DATE_SUB(CURDATE(), INTERVAL 7 DAY) <= date(column_time);
查询最近一天的数据
select * from table where to_days(column_time) = to_days(now());
select * from table where date(column_time) = curdate();?
查询最近一个月的数据
select * from table?where DATE_SUB(CURDATE(), INTERVAL INTERVAL 1 MONTH) <= date(column_time);
例如:
SELECT
DATE_FORMAT( create_time, ‘%Y-%m-%d‘ ) days,
phone_model ,
count(*) count
FROM
( SELECT * FROM trial_feedback_pdm WHERE DATE_SUB( CURDATE( ), INTERVAL 7 DAY ) <= date( create_time) ) as day
GROUP BY
days,phone_model;
参考链接:
https://blog.csdn.net/sugar_map/article/details/83857449
标签:mat int rom rdate 查询 alt csdn http 业务
原文地址:https://www.cnblogs.com/proper128/p/13029847.html