From: | Steve Clark <sclark(at)netwolves(dot)com> |
---|---|
To: | pgsql <pgsql-general(at)postgresql(dot)org> |
Subject: | Get sum of sums |
Date: | 2016-05-03 19:48:12 |
Message-ID: | 49bee1e5-a842-2d48-7c49-84cc6b3ff8dd@netwolves.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi List,
I have the following table that has netflow data. I can get the top ten receivers by the query below - but I would also like to get
at the same time a grand total of the RX Bytes. I am not exactly sure how to do it. This is with version 8.4.
select ip_dst as "Receiver" ,sum(bytes) as "RX Bytes" from acct_v9 where stamp_inserted >= '2016-04-26' and stamp_inserted <= '2016-04-30' and tag=246 group by ip_dst order by "RX Bytes" desc limit 10;
Receiver | RX Bytes
----------------+-------------
172.24.110.93 | 40363536915
172.24.110.81 | 6496041533
172.24.110.123 | 4891514009
172.24.16.10 | 4540333516
172.24.110.151 | 4101253631
192.168.198.71 | 3303066724
172.24.110.121 | 2529532947
172.24.110.101 | 2506527294
172.21.64.99 | 2472842640
172.24.110.83 | 2232550271
Thanks,
Steve
--
From | Date | Subject | |
---|---|---|---|
Next Message | Victor Yegorov | 2016-05-03 19:57:57 | Re: Get sum of sums |
Previous Message | Jeff Janes | 2016-05-03 17:45:19 | Re: Insert only table and size of GIN index JSONB field. |