Re: count( only if true)

Поиск
Список
Период
Сортировка
От Martín Marqués
Тема Re: count( only if true)
Дата
Msg-id 200510121619.09942.martin@bugs.unl.edu.ar
обсуждение исходный текст
Ответ на count( only if true)  (peter pilsl <pilsl@goldfisch.at>)
Ответы Re: count( only if true)  (peter pilsl <pilsl@goldfisch.at>)
Список pgsql-general
El Mié 12 Oct 2005 15:42, peter pilsl escribió:
> the count-aggreate counts every expression that does not evaluate to null.
>
> I would like to have a count that counts all values that are true.
>
> Do I really need to make a count( case when expression then 't' else
> null) to implement this?

I'm not sure what exactly it is you want, but check this:

SELECT count(*) FROM tab WHERE expresion

There you get a count of tuples that satisfy the expresion. What NULL values
are you talking about? Can you hand an example?

--
 16:17:02 up 8 days,  7:23,  1 user,  load average: 0.98, 1.27, 1.27
---------------------------------------------------------
Lic. Martín Marqués         |   SELECT 'mmarques' ||
Centro de Telemática        |       '@' || 'unl.edu.ar';
Universidad Nacional        |   DBA, Programador,
    del Litoral             |   Administrador
---------------------------------------------------------

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

Предыдущее
От: "A. Kretschmer"
Дата:
Сообщение: Re: count( only if true)
Следующее
От: Nicolao Renè
Дата:
Сообщение: Help with asynchronous queries