select 时间,
count(*),
AVG(TIMESTAMPDIFF(second, 开始时间 , 结束时间)) as time
from 表名
where 时间 >=DATE_SUB(CURDATE(), INTERVAL 7 DAY)
and to_days(时间) <to_days(now())
group by date_format(时间, '%y-%m-%d');
select 时间,
count(*),
AVG(TIMESTAMPDIFF(second, 开始时间 , 结束时间)) as time
from 表名
where 时间 >=DATE_SUB(CURDATE(), INTERVAL 7 DAY)
and to_days(时间) <to_days(now())
group by date_format(时间, '%y-%m-%d');
本文标题:【Mysql】获取近7天数据不包含当天数据
本文链接:https://www.haomeiwen.com/subject/mjpchrtx.html
网友评论