Received: from the-rowan.albatross.co.nz (ns.albatross.co.nz [203.97.5.1]) by hub.org (8.9.3/8.9.3) with ESMTP id UAA65949 for ; Wed, 18 Aug 1999 20:07:50 -0400 (EDT) (envelope-from drew@albatross.co.nz) Received: from zair (drew@zair.csarc.otago.ac.nz [139.80.20.4]) by the-rowan.albatross.co.nz (8.9.1/8.9.1) with SMTP id MAA19169 for ; Thu, 19 Aug 1999 12:09:31 +1200 Message-Id: <4.1.19990819115506.00cfd890@pern.csarc.otago.ac.nz> X-Sender: drew@mail.albatross.co.nz X-Mailer: QUALCOMM Windows Eudora Pro Version 4.1 Date: Thu, 19 Aug 1999 11:59:21 +1200 To: pgsql-sql@postgreSQL.org From: Drew Whittle Subject: Counting the number of distinct rows returned In-Reply-To: References: <23231.934923869@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" 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