Re: Aggregate question (Sum) - Mailing list pgsql-sql

From Rodrigo De León
Subject Re: Aggregate question (Sum)
Date
Msg-id a55915760711191311s115535d5ofe9d0ebb99714b9b@mail.gmail.com
Whole thread Raw
In response to Aggregate question (Sum)  ("Luiz K. Matsumura" <luiz@planit.com.br>)
Responses Re: Aggregate question (Sum)  ("Luiz K. Matsumura" <luiz@planit.com.br>)
List pgsql-sql
On Nov 19, 2007 3:46 PM, Luiz K. Matsumura <luiz@planit.com.br> wrote:
> If someone can give me some hint I will apreciate.

This is more of a normalization problem. See:

http://www.deeptraining.com/litwin/dbdesign/FundamentalsOfRelationalDatabaseDesign.aspx

and lookup Third Normal Form.

You have a calculated total for each order, so I assume there's a
price for every product. You should join order_item to whichever table
has the individual cost for each product and multiply it by
order_item.qty.

Good luck.


pgsql-sql by date:

Previous
From: "Luiz K. Matsumura"
Date:
Subject: Aggregate question (Sum)
Next
From: "Luiz K. Matsumura"
Date:
Subject: Re: Aggregate question (Sum)