Bernt M. Johnsen wrote:
Great help . honestly you ease my work too much.Answer to both of Legolas' questions: Consider table x with a timestamp field like this:ij> select * from x; D -------------------------- 2005-11-28 10:26:33.0 2005-11-28 10:26:33.0 2005-11-28 11:26:33.0 2005-11-28 13:26:33.0 2005-11-28 14:26:33.0 2005-11-28 14:00:33.0 2005-11-28 14:01:33.0 To count the number of timestamps and group them by the hour: ij> select h,count(*) from (select hour(d) from x) as t(h) group by h; H |2 ----------------------- 10 |2 11 |1 13 |1 14 |3 To extract the year, month, day etc. from table x: ij> select year(d),month(d),day(d),hour(d),minute(d),second(d) from x; 1 |2 |3 |4 |5 |6 ---------------------------------------------------------------------------------- 2005 |11 |28 |10 |26 |33.0 2005 |11 |28 |10 |26 |33.0 2005 |11 |28 |11 |26 |33.0 2005 |11 |28 |13 |26 |33.0 2005 |11 |28 |14 |26 |33.0 2005 |11 |28 |14 |0 |33.0 2005 |11 |28 |14 |1 |33.0 Thank you very much. |
- Re: how to count total number of records in each group , ... Legolas Woodland
- Re: how to count total number of records in each gro... Bernt M. Johnsen
