From: Stephan Szabo <sszabo@megazone.bigpanda.com>
To: Thomas F.O'Connell <tfo@sitening.com>
Cc: PgSQL - SQL <pgsql-sql@postgresql.org>
Subject: Re: Counting Distinct Records
Date: Tue, 16 Nov 2004 12:03:35 -0800 (PST)
Message-ID: <20041116115807.E79990@megazone.bigpanda.com> (raw)
In-Reply-To: <1B2F7B00-3808-11D9-95C2-000D93AE0944@sitening.com>
References: <1B2F7B00-3808-11D9-95C2-000D93AE0944@sitening.com>
On Tue, 16 Nov 2004, Thomas F.O'Connell wrote:
> I am wondering whether the following two forms of SELECT statements are
> logically equivalent:
>
> SELECT COUNT( DISTINCT table.column ) ...
>
> and
>
> SELECT DISTINCT COUNT( * ) ...
Not in general.
The former counts how many distinct table.column values there are. The
distinct in the latter would be basically meaningless unless there's a
group by involved.
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 using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: sszabo@megazone.bigpanda.com, tfo@sitening.com
Subject: Re: Counting Distinct Records
In-Reply-To: <20041116115807.E79990@megazone.bigpanda.com>
* 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