Re: count() and multiple tables - Mailing list pgsql-sql

From Josh Berkus
Subject Re: count() and multiple tables
Date
Msg-id web-27008@davinci.ethosmedia.com
Whole thread Raw
In response to Re: count() and multiple tables  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
List pgsql-sql
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
informationtechnology      josh@agliodbs.com  and data management solutions       (415) 565-7293 for law firms, small
businesses       fax 621-2533   and non-profit organizations.      San Francisco
 


pgsql-sql by date:

Previous
From: Joseph Shraibman
Date:
Subject: Re: VACUUM kills Index Scans ?!
Next
From: Richard Huxton
Date:
Subject: Re: serial type question