distinct with sum - Mailing list pgsql-sql

From mbobi@mac.com
Subject distinct with sum
Date
Msg-id 5644020.1152434024188.JavaMail.mbobi@mac.com
Whole thread Raw
List pgsql-sql
I need to list products from the table of ordered products with ordered quantities. Each product should be there only
oncebut quantity should be a sum from all the same products from the table.
 
I prepared some query but in quantity column I can see only amount from one record. I need to have sum there.

The query:
select distinct on (id_prod) id_prod, id_unit, sum(quantity) as result from products where determinant = false group by
id_prod,id_unit
 

Thanks in advance for your help.


pgsql-sql by date:

Previous
From: "Luca Giandoso"
Date:
Subject: information_schema for all users
Next
From: Hélder M. Vieira
Date:
Subject: Re: distinct with sum