From: | "Andrew Snow" <als(at)fl(dot)net(dot)au> |
---|---|
To: | <andrea(dot)aime(at)comune(dot)modena(dot)it> |
Cc: | "Pgsql-General(at)Postgresql(dot) Org" <pgsql-general(at)postgresql(dot)org> |
Subject: | RE: count & distinct |
Date: | 2000-06-15 10:53:42 |
Message-ID: | NHEALMDKDACEIPBNOOOCAEKACFAA.als@fl.net.au |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
> Hi people. I would like to make a query that
> tells me how many distinct values there are
> in a column. Standard count doesn't seems
> to support a count distinct option.
> select distint count(*) of course doens't
> work (distinti clause is applied after the
> result are calculated). I've tried to define
> a view, but it didn't worked (
> create view distValues as select distinct ...
> but views doesn't support distinct clause)...
SELECT COUNT(DISTINCT field_name) FROM table_name;
Works for me in v7.
Regards,
Andrew Snow
als(at)fl(dot)net(dot)au
From | Date | Subject | |
---|---|---|---|
Next Message | Vashenko Maxim | 2000-06-15 11:23:12 | Re: group by problem |
Previous Message | Marcos Lloret | 2000-06-15 10:53:14 | NOTICE: DateStyle is Postgres with Eropean convention |