我有一个表,每 15 分钟保存我的上传/下载统计信息。
这就是表格的样子
| ID | timestamp | upload | download | packetssent | packetsreceived
| 1 | 1328828401 | 343245 | 93473463 | 4343423 | 3435664
| 2 | 1328829301 | 343245 | 93473463 | 4343423 | 3435664
我想要的是当您首先进入页面时您会看到总下载/上传。然后是可用月份的列表。 (所以目前只有二月),一旦您单击一个月,它将显示当天及其总计,当您单击一天时,您将看到该日的所有记录
我需要建议如何执行此操作。
提前致谢
I have a table that saves my upload / download statistics per 15 minutes.
This is what the table looks like
| ID | timestamp | upload | download | packetssent | packetsreceived
| 1 | 1328828401 | 343245 | 93473463 | 4343423 | 3435664
| 2 | 1328829301 | 343245 | 93473463 | 4343423 | 3435664
What i want is when you come first on the page you see total download/upload. And then a list of the months available. (So currently is that only February), Once you click on a month, it wil show the day's and their totals, when you click on a day, you will see all records for that single day
I need advice how to do this.
Thanks in advance
发布评论
评论(3)
要提取各种值,请使用 MySQL 中的日期/时间函数
您可以在
group by
部分中使用这些函数来提取取决于各种时间范围的信息看一下:http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html 查看完整列表
To extract the various values, use the date/time functions in MySQL
You can use these in
group by
sections to extract your information dependent on a variety of time framesHave a look at: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html for a full list
尝试以下操作(针对当前年份):
Try the following (for the current year):
我认为你可以使用
你可能会逃脱
但如果你可以 文档 没有说明您可以向其传递时间戳。
I think you can use
You might get away with
but if you can the documentation for the MONTH() function doesn't state that you can pass a timestamp to it.