From: Tod McQuillin <devin@spamcop.net>
To: Olaf Zanger <olaf.zanger@soli-con.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: sum(bool)?
Date: Fri, 23 Feb 2001 09:43:21 -0600 (CST)
Message-ID: <Pine.GSO.4.31.0102230941300.13223-100000@sysadmin> (raw)
In-Reply-To: <3A9681AD.55A3F355@soli-con.com>
On Fri, 23 Feb 2001, Olaf Zanger wrote:
> i'd like to add up the "true" values of a comparison like
>
> sum(a>b)
>
> it just doesn't work like this
Try
sum(case when a>b then 1 else 0 end)
--
Tod McQuillin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: devin@spamcop.net, olaf.zanger@soli-con.com
Subject: Re: sum(bool)?
In-Reply-To: <Pine.GSO.4.31.0102230941300.13223-100000@sysadmin>
References: <3A9681AD.55A3F355@soli-con.com> <Pine.GSO.4.31.0102230941300.13223-100000@sysadmin>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox