pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Huxton <dev@archonet.com>
To: Martin Kuria <martinkuria@hotmail.com>
Cc: olly@lfix.co.uk
Cc: middink@indo.net.id
Cc: pgsql-sql@postgresql.org
Subject: Re: SUM() & GROUP BY
Date: Fri, 07 May 2004 09:00:43 +0100
Message-ID: <409B422B.6080502@archonet.com> (raw)
In-Reply-To: <Sea2-F26v29H72folri0000e4e9@hotmail.com>
References: <Sea2-F26v29H72folri0000e4e9@hotmail.com>

Martin Kuria wrote:
> Hi again I have two tables I would like to query i.e. service table and 
> division table
> 
> SELECT s.pd_geo, COUNT(s.pd_geo) FROM ser s GROUP BY s.pd_geo;
> OUTPUT:
> pd_geo | count
> ----------------------
>  1        |   49
>  2        |   39
>  3        |    6
>  4        |    54
> 
> SELECT d.divisions_name, d.divisions_id)
> FROM ser s, ser_divisions d
> WHERE d.divisions_id = s.ser_divisions;
> 
> division_name | divisions_id
> --------------------------------------
>  DEC            |   6
>  DEPI           |   7
>  DRC            |    8
> 
> How can I create a query that displays  How the divisions answered the 
> question please do assist.

Martin - you'll need to explain exactly what you want. Can you show what 
  outputs you would like given the above data?

-- 
   Richard Huxton
   Archonet Ltd



view thread (9+ messages)  latest in thread

Message-ID: <409B422B.6080502@archonet.com>
Permalink:  ../409B422B.6080502@archonet.com/
Also on:    postgresql.org/message-id/409B422B.6080502@archonet.com

 · 

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: dev@archonet.com, martinkuria@hotmail.com, olly@lfix.co.uk, middink@indo.net.id
  Subject: Re: SUM() & GROUP BY
  In-Reply-To: <409B422B.6080502@archonet.com>

* 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