Abdlhamed, Mohamed <M.A.Abdlhamed@2013.ljmu.ac.uk> wrote:
> I am new to PostgreSQL and SQL. I want to apply HLL in PostgreSQL on a table
> contain traffic information each stored in separate column, so I want to
> estimate the cardinality of every distinct IP. the cardinality here is how many
> ports contacted distinct per IP. IPs stored in 'Destination' column and ports
> stored in 'DetsPort'. can anyone help me with full code and steps please!
if i understand you, you have a table with 2 columns, 'destination' and
'destport', right? And you want to know how many ports per destination
there are, right?
select
destination
, count(destport)
from <insert_the_table_name_here>
group by destination;
Regards, Andreas Kretschmer
--
Andreas Kretschmer
http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services