pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: jasiek@klaster.net
To: Rudi Starcevic <rudi@oasis.net.au>
Cc: pgsql-sql@postgresql.org
Subject: Re: Count equals 0
Date: Tue, 18 Mar 2003 12:37:22 +0100
Message-ID: <20030318113722.GA16600@serwer.skawsoft.com.pl> (raw)
In-Reply-To: <3E76BCB9.9070603@oasis.net.au>
References: <3E76BCB9.9070603@oasis.net.au>

On Tue, Mar 18, 2003 at 04:29:13PM +1000, Rudi Starcevic wrote:
<cut>
> What I would like to see is something like:
> 
> site a : 0
> site b : 3
> site c : 6
<cut>
Maybe something like this:
select um.site_name,
 count(*)-sum(case when usm.cus_id is null then 1 else 0 end) as total
from user_main um
 left_join user_sys_messages usm using (cus_id)
 group by um.site_name
 order by um.site_name;



view thread (5+ messages)  latest in thread

Message-ID: <20030318113722.GA16600@serwer.skawsoft.com.pl>
Permalink:  ../20030318113722.GA16600@serwer.skawsoft.com.pl/
Also on:    postgresql.org/message-id/20030318113722.GA16600@serwer.skawsoft.com.pl

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: jasiek@klaster.net, rudi@oasis.net.au
  Subject: Re: Count equals 0
  In-Reply-To: <20030318113722.GA16600@serwer.skawsoft.com.pl>

* 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