From: Josh Berkus <josh@agliodbs.com>
To: Stephan Szabo <sszabo@megazone23.bigpanda.com>
To: Joseph Shraibman <jks@selectacast.net>
Cc: pgsql-sql@postgresql.org <pgsql-sql@postgresql.org>
Subject: Re: count() and multiple tables
Date: Mon, 19 Mar 2001 20:46:39 -0800
Message-ID: <web-27008@davinci.ethosmedia.com> (raw)
In-Reply-To: <Pine.BSF.4.21.0103191720420.27292-100000@megazone23.bigpanda.com>
Stephan, Joseph,
> Because d.id was guaranteed to be unique, you might be able to
> count(distinct d.id) and get the result you want. [I think the
> subquery is a nicer way of representing it]
Plus a several SQL implementations don't implement the DISTINCT until
after the COUNT, reuslting in a still-inflated (and sometimes varying!)
COUNT. It won't work properly in T-SQL or MS Office SQL, for example.
-Josh Berkus
______AGLIO DATABASE SOLUTIONS___________________________
Josh Berkus
Complete information technology josh@agliodbs.com
and data management solutions (415) 565-7293
for law firms, small businesses fax 621-2533
and non-profit organizations. San Francisco
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: josh@agliodbs.com, sszabo@megazone23.bigpanda.com, jks@selectacast.net
Subject: Re: count() and multiple tables
In-Reply-To: <web-27008@davinci.ethosmedia.com>
References: <Pine.BSF.4.21.0103191720420.27292-100000@megazone23.bigpanda.com> <web-27008@davinci.ethosmedia.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