pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ed <dziablo@lords.com>
To: pgsql sql <pgsql-sql@postgresql.org>
Subject: One query for two information...
Date: Tue, 18 Apr 2000 10:26:25 -0400
Message-ID: <001d01bfa942$13d93180$b48c29d1@citenet.net> (raw)

Hi,

I have a table containing only a bool filed.  I would like to know how many
records there is an on many ar true.

Is there something I could do to get both answer in only one query...   like
:

select count(*), sum(bool_col) from tablename

but there is no sum(bool) function that would add 1 if it's true and 0 if
it's false... ;(

Any idea?

Frédéric Boucher
dziablo@lords.com





view thread (2+ messages)  latest in thread

Message-ID: <001d01bfa942$13d93180$b48c29d1@citenet.net>
Permalink:  ../001d01bfa942$13d93180$b48c29d1@citenet.net/
Also on:    postgresql.org/message-id/001d01bfa942$13d93180$b48c29d1@citenet.net

 · 

reply

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: dziablo@lords.com
  Subject: Re: One query for two information...
  In-Reply-To: <001d01bfa942$13d93180$b48c29d1@citenet.net>
  References: <001d01bfa942$13d93180$b48c29d1@citenet.net>

* 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