Re: Aggregate question (Sum)

From: Rodrigo De León <rdeleonp(at)gmail(dot)com>
To: "Luiz K(dot) Matsumura" <luiz(at)planit(dot)com(dot)br>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Aggregate question (Sum)
Date: 2007-11-19 21:11:39
Message-ID: a55915760711191311s115535d5ofe9d0ebb99714b9b@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Nov 19, 2007 3:46 PM, Luiz K. Matsumura <luiz(at)planit(dot)com(dot)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.

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Luiz K. Matsumura 2007-11-19 23:17:26 Re: Aggregate question (Sum)
Previous Message Luiz K. Matsumura 2007-11-19 20:46:50 Aggregate question (Sum)