Re: Question about a query with two count fields

From: Rodrigo De León <rdeleonp(at)gmail(dot)com>
To: delux256-postgresql(at)yahoo(dot)com
Cc: "PostgreSQL GENERAL List" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Question about a query with two count fields
Date: 2007-09-11 16:02:02
Message-ID: a55915760709110902g4fc7fa16g8c3227a4bb5a94ed@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 9/11/07, Jeff Lanzarotta <delux256-postgresql(at)yahoo(dot)com> wrote:
> I appreciate the help...

SELECT TO_CHAR(ts, 'MM/DD/YYYY') AS "day", str, proc
, SUM(CASE
WHEN z <> 0
THEN 1
ELSE 0
END) AS good, 0 AS ajaaaaaaaaaaaaaa
, SUM(CASE
WHEN z = 0
THEN 1
ELSE 0
END) AS bad
FROM foobar
WHERE str <> 99999
GROUP BY str, DAY, proc
ORDER BY str

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dmitry Koterov 2007-09-11 16:02:34 Sthange things happen: SkyTools pgbouncer is NOT a balancer
Previous Message George Pavlov 2007-09-11 15:55:53 Re: Question about a query with two count fields