From: Lars Haugseth <pgsql@larshaugseth.com>
To: pgsql-admin@postgresql.org
Cc: richard@orbisindonesia.com
Subject: Re: How this query!
Date: Thu, 25 Aug 2005 14:21:20 +0200
Message-ID: <87pss2qkan.fsf@skapulf.larshaugseth.com> (raw)
References: <62683.202.152.170.186.1124970240.squirrel@202.152.170.186>
* richard@orbisindonesia.com ("Richard Susanto") wrote:
|
| Folks,
| would you like help me how to query this case.
|
| I have tbl_a, the fields are :
| item_record
| item_product_name
| item_qty
|
|
| if the data are :
|
| item_record = 1,2,3,4,5,6
| item_product_name = a,b,a,c,d,c,...
| item_qty = 10,5,15,10,20,5,...
|
| How the query to sum item_qty_total if i want the result :
| item_product_name = a,b,c,d
| item_qty_total = 25,5,15,20
SELECT item_product_name, sum(item_qty) FROM tbl_a GROUP BY item_product_name;
--
Lars Haugseth
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: pgsql@larshaugseth.com, pgsql-admin@postgresql.org, richard@orbisindonesia.com
Subject: Re: How this query!
In-Reply-To: <87pss2qkan.fsf@skapulf.larshaugseth.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