From: | Martín Marqués <martin(at)bugs(dot)unl(dot)edu(dot)ar> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Cc: | peter pilsl <pilsl(at)goldfisch(dot)at> |
Subject: | Re: count( only if true) |
Date: | 2005-10-12 19:19:09 |
Message-ID: | 200510121619.09942.martin@bugs.unl.edu.ar |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
---------------------------------------------------------
From | Date | Subject | |
---|---|---|---|
Next Message | A. Kretschmer | 2005-10-12 19:20:24 | Re: count( only if true) |
Previous Message | peter pilsl | 2005-10-12 18:42:02 | count( only if true) |