From: | Larry Rosenman <ler(at)lerctr(dot)org> |
---|---|
To: | PostgreSQL SQL List <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: trying to summarize into a new table by time... |
Date: | 2001-06-02 13:50:12 |
Message-ID: | 20010602085012.A28751@lerami.lerctr.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
* Larry Rosenman <ler(at)lerctr(dot)org> [010602 05:17]:
> Where we group into six hour groupings.
>
> I came up with the following:
>
> insert into traffic_summary
> select asn,protocol,
> cast(sum(pkts_src) as float) as pkts_src,
> cast(sum(pkts_dst) as float) as pkts_dst,
> cast(sum(bytes_src) as float) as bytes_src,
> cast(sum(bytes_dst) as float) as bytes_dst,
> cast(sum(secs_src) as float) as secs_src,
> cast(sum(secs_dst) as float) as secs_dst,
> min(early) as early,
> max(late) as late
> from traffic
> where early >= '2001-01-01 00:00:00' and
> early <= '2001-01-02 05:59:59'
> GROUP BY asn,protocol;
>
I *THINK* I can change the GROUP BY to add date_trunc('hour',early)
and get what I want to the hour.
How can I get 6 hours?
--
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 972-414-9812 E-Mail: ler(at)lerctr(dot)org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2001-06-02 14:16:12 | Re: trying to summarize into a new table by time... |
Previous Message | Clayton Cottingham aka drfrog | 2001-06-02 11:43:37 | list of returns types for functions |