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 |     0
>  a |     1
> (5 rows)

For simple cases like this you probably want to do the following:
SELECT x, count(*) FROM test2 WHERE id < 5 GROUP BY x

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
       subscribe-nomail command to [EMAIL PROTECTED] so that your
       message can get through to the mailing list cleanly

Reply via email to