counting distinct values

From: Joseph Shraibman <jks(at)selectacast(dot)net>
To: "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Subject: counting distinct values
Date: 2000-06-07 23:52:16
Message-ID: 393EE030.C4F9897E@selectacast.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Using the example from
http://www.postgresql.org/docs/aw_pgsql_book/node59.html, what would I
do if I wanted to know the number of different cities where I had a
friend in each state? select count(city) group by state; would not work
because if you had two friends in the same city it would be counted
twice.

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Bruce Momjian 2000-06-08 00:15:58 Re: counting distinct values
Previous Message Cary O'Brien 2000-06-07 22:47:39 Re: Re: [SQL] oracle rownum equivalent?