这是我的表 emp 的两列,我试图在我的动态 Web 应用程序(servlet,jsp)中触发 2 个单独的查询,其中 Id 能够从表中获取我的数据;
+-------------------------+----------+
| date | serialNo |
+-------------------------+----------+
| 2012-11-21 15:14:08.323 | 6 |
| 2012-11-21 12:48:12.067 | 6 |
| 2012-11-21 09:00:16.559 | 8 |
| 2012-11-21 05:24:20.091 | 9 |
| 2012-11-21 01:11:24.413 | 6 |
| 2012-11-21 14:57:28.531 | 11 |
| 2012-11-21 17:04:31.86 | 9 |
| 2012-11-21 19:33:36.259 | 13 |
| 2012-11-21 20:21:40.524 | 9 |
| 2012-11-21 23:00:44.362 | 8 |
| 2012-11-21 00:24:53.613 | 11 |
我要实施
划分时间而不考虑日期,例如
Time Division | Count
| 00:00:00 - 05:59:59 | 3
| 06:00:00 - 11:59:59 | 1| 12:00:00 - 17:59:59 | 4
查询: select date count(*) as Count from info where (date between '%00:00:00%' and '%05:59:59%' or date between '%06:00:00%' and '%11:59:59%' or date between '%12:00:00%' and '%17:59:59%') group by date.
:( :(
我发现我一点也不接近 :( 我的查询中的任何一个,所以我在这个论坛上提出这个问题。欢迎在此背景下提供任何类型的输入。