From: | Richard Huxton <dev(at)archonet(dot)com> |
---|---|
To: | Martin Kuria <martinkuria(at)hotmail(dot)com> |
Cc: | olly(at)lfix(dot)co(dot)uk, middink(at)indo(dot)net(dot)id, pgsql-sql(at)postgresql(dot)org |
Subject: | Re: SUM() & GROUP BY |
Date: | 2004-05-07 08:00:43 |
Message-ID: | 409B422B.6080502@archonet.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Freddy Villalba Arias | 2004-05-07 08:20:52 | EXPORT / IMPORT |
Previous Message | Martin Kuria | 2004-05-07 06:47:35 | Re: SUM() & GROUP BY |