Re: SUM() & GROUP BY - Mailing list pgsql-sql

From Richard Huxton
Subject Re: SUM() & GROUP BY
Date
Msg-id 409B422B.6080502@archonet.com
Whole thread Raw
In response to Re: SUM() & GROUP BY  ("Martin Kuria" <martinkuria@hotmail.com>)
List pgsql-sql
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


pgsql-sql by date:

Previous
From: "Martin Kuria"
Date:
Subject: Re: SUM() & GROUP BY
Next
From: "Freddy Villalba Arias"
Date:
Subject: EXPORT / IMPORT