Search Postgresql Archives

Re: count( only if true)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
---------------------------------------------------------

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

               http://archives.postgresql.org


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux