[英]COUNT Data from the past 7 days, but have it so it shows the result for each day in those 7 days
I don't really know how to explain it, but I have a Morris.JS chart in my Web appliication and I want to have the ability to get data from the last 7 days and put it into the chart. 我真的不知道如何解释它,但是我在Web应用程序中有一个Morris.JS图表,我希望能够从最近7天获取数据并将其放入图表中。
I don't know if using DATE formats work in a Query nor do I know how to do it, so I'm here asking for assistance on it. 我不知道在查询中使用DATE格式是否有效,也不知道如何执行,所以我在这里寻求帮助。
My columns are x
as the value and datetime
as the datetime and I don't know how I would get the value of X for each day for 7 days. 我的列是值的x
和datetime
的datetime,我不知道如何获得7天中每一天的X值。
Hopefully this makes sense? 希望这有意义吗?
选择,添加日期,按日期分组。
SELECT DATE(DATE_ADD(my_date, - INTERVAL 7 DAY)), my_data, other_data from TABLE_NAMER group by DATE(DATE_ADD(my_date, - INTERVAL 7 DAY))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.