Re: [GENERAL] count( only if true)

2005-10-26 Thread Bruno Wolff III
On Wed, Oct 12, 2005 at 22:24:48 +0200, peter pilsl <[EMAIL PROTECTED]> wrote: > > knowledge=# select x,count(case when id<5 then 't' else null end) from > test2 group by x; > x | count > ---+--- > e | 1 <- thats the result I want !!! > b | 1 > c | 1 > d |

Re: [GENERAL] count( only if true)

2005-10-12 Thread Jim Buttafuoco
0200 Subject: Re: [GENERAL] count( only if true) > Martín Marqués wrote: > > > > 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 expresio

Re: [GENERAL] count( only if true)

2005-10-12 Thread peter pilsl
Martín Marqués wrote: 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? thnx. # select * from test2; x | id ---

Re: [GENERAL] count( only if true)

2005-10-12 Thread Martín Marqués
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'

Re: [GENERAL] count( only if true)

2005-10-12 Thread A. Kretschmer
am 12.10.2005, um 20:42:02 +0200 mailte peter pilsl folgendes: > > 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) >

[GENERAL] count( only if true)

2005-10-12 Thread peter pilsl
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? thnx, peter -- mag. peter pilsl goldfisch.at IT-manage