Doing a conditional aggregate (e.g. count(*) if x=y) in postgres? - Mailing list pgsql-sql

From Bryce Nesbitt
Subject Doing a conditional aggregate (e.g. count(*) if x=y) in postgres?
Date
Msg-id 4648E8F1.4020609@obviously.com
Whole thread Raw
Responses Re: Doing a conditional aggregate (e.g. count(*) if x=y) in postgres?  ("Jim Buttafuoco" <jim@contactbda.com>)
Re: Doing a conditional aggregate (e.g. count(*) if x=y) in postgres?  (Geoff Tolley <geoff@polimetrix.com>)
List pgsql-sql
All;
Is there a way to get a conditional aggregate?  I have this two column view:
SELECT count(*) AS count, xx_plan.plan_name  FROM xx_membership  JOIN xx_account USING (account_id)  JOIN xx_plan USING
(plan_id)WHERE xx_membership.status = 10 GROUP BY xx_plan.plan_name;
 

And would like to add additional columns (not rows) breaking out
"status=20" and "status=30" totals.
Is this possible without a stored procedure?



pgsql-sql by date:

Previous
From: Richard Dunne
Date:
Subject: pg_dump?
Next
From: Paul Lambert
Date:
Subject: Re: pg_dump?