Re: Do I just not understand count()?

Поиск
Список
Период
Сортировка
От Gregory Wood
Тема Re: Do I just not understand count()?
Дата
Msg-id 003f01c1df2d$12a8f6b0$7889ffcc@comstock.com
обсуждение исходный текст
Ответ на Do I just not understand count()?  (Ben <bench@silentmedia.com>)
Ответы Re: Do I just not understand count()?  (Ben <bench@silentmedia.com>)
Список pgsql-general
I don't think I've seen that particular syntax used before (I would say
select count(a) from t where a=1;), but since the query appears to work, I
won't argue.

Why do you think it should give you a result of 1? There are two rows
containing a value of 1 for a, hence it returns 2.

Greg

----- Original Message -----
From: "Ben" <bench@silentmedia.com>
To: <pgsql-general@postgresql.org>
Sent: Monday, April 08, 2002 2:25 PM
Subject: [GENERAL] Do I just not understand count()?


> If I have the table t defined as:
>
>  a
> ---
>  1
>  1
>  2
>
>
> and I say:
>
> select count(a=1) from t;
>
> should it give me 1 or 2 as a result? I'm getting 2, and I'd think I
> should get 1....
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>


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

Предыдущее
От: Ben
Дата:
Сообщение: Do I just not understand count()?
Следующее
От: Ben
Дата:
Сообщение: Re: Do I just not understand count()?