简体   繁体   English

过去7天的COUNT个数据,但有此数据可以显示过去7天每天的结果

[英]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. 我的列是值的xdatetime的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.

相关问题 我如何才能获取过去7天中只有记录的那几天的MySQL记录,并每天返回记录呢? - How can I get MySQL records from past 7 days, but only days that have a record, and return each day as a record? 询问从当前日期到未来7天以及过去7天的数据 - ask data's from current date to 7 days ahead and past 7 days 如何计算 PHP 中的天数以创建从 365 天到第 1 天的日期范围数组 - How to count days of year PHP to create day range array wrapping past day 365 to day 1 PHP:计算过去几小时/天 - PHP: Count the past hours / days 接下来7天的生日计数,每一天的计数和总计 - Count of birthdays for next 7 days and need count for each day and total 显示过去几天的结果 - Display results from past days 我的最后期限是5天,我需要在每个非工作日(周末或假日)增加+1天 - I have a deadline is 5 days I need to add +1 day for each non-working days (weekend or holiday) 单个查询以获取过去7天的个人计数 - Single query to get count of individual of past 7 days 如何计算从当前系统日期到过去和未来日期的365天,并使用php和mysql相应地获取数据 - How to count 365 days from current system date to past and future date and fetch the data accordingly using php and mysql 从总共 35 天中获取每天的不同值 PHP - Get different values for each day from total of 35 days PHP
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM