Re: select syntax question

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема Re: select syntax question
Дата
Msg-id 20021101215900.GA2290@wolff.to
обсуждение исходный текст
Ответ на select syntax question  (Wei Weng <wweng@kencast.com>)
Список pgsql-sql
On Fri, Nov 01, 2002 at 16:33:32 -0500, Wei Weng <wweng@kencast.com> wrote:
> This is what is on postgresql's manual page:
> 
> According to this syntax, SELECT DISTINCT COUNT(ID) FROM test
> should be valid while SELECT COUNT(DISTINCT ID) FROM test otherwise.
> 
> while in fact, both are valid.
> 
> Is there any difference between this two queries?

They mean different things.

The first will return the number of rows with non-null values for id.
Since only one row is returned it is guarenteed to be distinct so the
distinct keyword will have no effect.

The second form will return the number of distinct, non-null values for id
in the table.


В списке pgsql-sql по дате отправления:

Предыдущее
От: Wei Weng
Дата:
Сообщение: select syntax question
Следующее
От: "Chad Thompson"
Дата:
Сообщение: Re: making queries more effecient