pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Drew Whittle <drew@albatross.co.nz>
To: pgsql-sql@postgreSQL.org
Subject: Counting the number of distinct rows returned
Date: Thu, 19 Aug 1999 11:59:21 +1200
Message-ID: <4.1.19990819115506.00cfd890@pern.csarc.otago.ac.nz> (raw)
In-Reply-To: <Pine.GSO.3.96.SK.990818085816.14567G-100000@ra>
References: <23231.934923869@sss.pgh.pa.us>

How can I return the number of records (ie a count(user_id)) when using a
statement like this:

select distinct user_id from sales_by_region;

I have tried things like:

select count(distinct user_id) from sales_by_region (parse error)
select distinct count(user_id) from sales_by_region (useless because count
is performed before the distinct)

HELP!

Thanks,

Drew





view thread (5+ messages)  latest in thread

Message-ID: <4.1.19990819115506.00cfd890@pern.csarc.otago.ac.nz>
Permalink:  ../4.1.19990819115506.00cfd890@pern.csarc.otago.ac.nz/
Also on:    postgresql.org/message-id/4.1.19990819115506.00cfd890@pern.csarc.otago.ac.nz

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: drew@albatross.co.nz
  Subject: Re: Counting the number of distinct rows returned
  In-Reply-To: <4.1.19990819115506.00cfd890@pern.csarc.otago.ac.nz>
  References: <23231.934923869@sss.pgh.pa.us> <4.1.19990819115506.00cfd890@pern.csarc.otago.ac.nz>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox