Re: count() and multiple tables

Поиск
Список
Период
Сортировка
От Josh Berkus
Тема Re: count() and multiple tables
Дата
Msg-id web-27008@davinci.ethosmedia.com
обсуждение исходный текст
Ответ на Re: count() and multiple tables  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Список 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 по дате отправления:

Предыдущее
От: Joseph Shraibman
Дата:
Сообщение: Re: VACUUM kills Index Scans ?!
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: serial type question