pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tomasz Myrta <jasiek@klaster.net>
To: pgsql-sql@postgresql.org
Cc: Ryan <pgsql-sql@seahat.com>
Subject: Re: aggregate question
Date: Tue, 24 Jun 2003 10:01:20 +0200
Message-ID: <3EF80550.7050508@klaster.net> (raw)
In-Reply-To: <3EF7797A.4040003@klaster.net>
References: <54717.65.102.128.233.1056394792.squirrel@fordparts.com>
	<3EF7797A.4040003@klaster.net>

Dnia 2003-06-24 00:04, Użytkownik Tomasz Myrta napisał:
>

> select package_name,
>  count(*) as n_packages
> from
>  packages
>  join package_log using (package_id);
> 

> And one more:
> select package_name,
>  sum(case when package_log.package_id is not null then 1 else 0 end)
>    as n_packages
> from
>  packages
>  left join package_log using (package_id);

Add "group by package_name" to these queries...
Tomasz




view thread (4+ messages)

Message-ID: <3EF80550.7050508@klaster.net>
Permalink:  ../3EF80550.7050508@klaster.net/
Also on:    postgresql.org/message-id/3EF80550.7050508@klaster.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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: jasiek@klaster.net, pgsql-sql@seahat.com
  Subject: Re: aggregate question
  In-Reply-To: <3EF80550.7050508@klaster.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