Re: count( only if true) - Mailing list pgsql-general

From Martín Marqués
Subject Re: count( only if true)
Date
Msg-id 200510121619.09942.martin@bugs.unl.edu.ar
Whole thread Raw
In response to count( only if true)  (peter pilsl <pilsl@goldfisch.at>)
Responses Re: count( only if true)
List 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 by date:

Previous
From: "A. Kretschmer"
Date:
Subject: Re: count( only if true)
Next
From: Nicolao Renè
Date:
Subject: Help with asynchronous queries