RoR3从表创建表格报告

时间:2012-01-10 00:13:17

标签: mysql ruby-on-rails ruby ruby-on-rails-3

将大量数据汇总到有用的表格报告中的最佳方法是什么。

例如:

+---------------------+---------------------+-------------------+
| acctstarttime       | acctstoptime        | calledstationid   |
+---------------------+---------------------+-------------------+
| 2011-12-31 15:41:46 | 2011-12-31 15:41:46 | 00-00-00-11-00-10 |
| 2011-12-31 15:42:00 | 2011-12-31 15:42:00 | 00-00-00-11-00-10 |
| 2011-12-31 15:42:08 | 2011-12-31 15:42:08 | 00-00-00-11-00-10 |
| 2011-12-31 15:44:26 | 2011-12-31 15:44:26 | 00-00-00-11-00-10 |
| 2011-12-31 15:44:47 | 2011-12-31 15:44:47 | 00-00-00-11-00-10 |
| 2011-12-31 15:45:03 | 2011-12-31 15:45:04 | 00-00-00-11-00-10 |
| 2011-12-31 15:45:30 | 2011-12-31 15:45:30 | 00-00-00-11-00-10 |
| 2011-12-31 15:47:01 | 2011-12-31 15:47:01 | 00-00-00-11-00-10 |
| 2011-12-31 15:48:29 | 2011-12-31 15:48:29 | 00-00-00-11-00-10 |
| 2011-12-31 15:48:54 | 2011-12-31 15:48:54 | 00-00-00-11-00-10 |
| 2012-01-02 23:47:09 | 2012-01-02 23:47:09 | 00-00-00-11-00-10 |
| 2012-01-02 23:47:16 | 2012-01-02 23:47:16 | 00-00-00-11-00-10 |
| 2012-01-02 23:47:17 | 2012-01-02 23:47:17 | 00-00-00-11-00-10 |
| 2012-01-02 23:47:18 | 2012-01-02 23:47:18 | 00-00-00-11-00-10 |
| 2012-01-02 23:47:19 | 2012-01-02 23:47:19 | 00-00-00-11-00-10 |
| 2012-01-04 17:58:51 | 2012-01-04 17:58:51 | 00-00-00-11-00-10 |
| 2012-01-08 23:24:07 | 2012-01-08 23:24:07 | 00-00-00-11-00-10 |
| 2012-01-08 23:50:31 | 2012-01-08 23:50:31 | 00-00-00-11-00-10 |
| 2012-01-08 23:50:59 | 2012-01-08 23:50:59 | 00-00-00-11-00-10 |
| 2012-01-08 23:50:59 | 2012-01-08 23:50:59 | 00-00-00-11-00-10 |
| 2012-01-08 23:51:00 | 2012-01-08 23:51:00 | 00-00-00-11-00-10 |
| 2012-01-08 23:51:01 | 2012-01-08 23:51:01 | 00-00-00-11-00-10 |
| 2012-01-08 23:51:17 | 2012-01-08 23:51:17 | 00-00-00-11-00-10 |
| 2012-01-09 00:00:13 | 2012-01-09 00:00:13 | 00-00-00-11-00-10 |
| 2012-01-09 00:00:20 | 2012-01-09 00:00:20 | 00-00-00-11-00-10 |
| 2012-01-09 00:06:29 | 2012-01-09 00:06:29 | 00-00-00-11-00-10 |
| 2012-01-09 00:06:54 | 2012-01-09 00:06:54 | 00-00-00-11-00-10 |
| 2012-01-09 00:07:08 | 2012-01-09 00:07:08 | 00-00-00-11-00-00 |
| 2012-01-09 00:07:50 | 2012-01-09 00:07:50 | 00-00-00-11-00-00 |
| 2012-01-09 00:07:51 | 2012-01-09 00:07:51 | 00-00-00-11-00-00 |
+---------------------+---------------------+-------------------+

我们有数千行,并且正在尝试创建一个表(然后是图表),首先按星期几汇总数据。基本上,我们会尝试按天/小时显示使用情况。例如,2011年1月1日至2011年1月31日之间:

 Monday     11
 Tuesday    14
 Wednesday  16
 Thursday   12
 Friday     09
 Saturday   77
 Sunday     08

是否有任何插件可以执行此操作,还是需要以其他方式进行汇总?

0 个答案:

没有答案