Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

distinct with sum

Status
Not open for further replies.

mbobi

Programmer
Jul 8, 2006
1
PL
I need to list products from the table of ordered products with ordered quantities. Each product should be there only once but quantity should be 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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top