Get sum of sums - Mailing list pgsql-general

From Steve Clark
Subject Get sum of sums
Date
Msg-id 49bee1e5-a842-2d48-7c49-84cc6b3ff8dd@netwolves.com
Whole thread Raw
Responses Re: Get sum of sums
Re: Get sum of sums
List 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
--

pgsql-general by date:

Previous
From: Jeff Janes
Date:
Subject: Re: Insert only table and size of GIN index JSONB field.
Next
From: Victor Yegorov
Date:
Subject: Re: Get sum of sums