Subject | Re: [IBO] SQL Problens |
---|---|
Author | Daniel Rail |
Post date | 2002-04-03T18:34:17Z |
At 03/04/2002 11:36 AM, you wrote:
SELECT
a.CodSale,
(SUM(b.PrItSale*b.QtItSale-DiscountItSale)-SUM(a.DiscountSale)) as
SaleValue
FROM Sale a
JOIN ItSale b
ON (b.CodSale = a.CodSale)
GROUP BY a.CodeSale
Daniel Rail
Senior System Engineer
ACCRA Group Inc. (www.accra.ca)
ACCRA Med Software Inc. (www.accramed.ca)
>Hi,Try this statement:
>
>I need create one calc of sum of sales. In my Application i have "Discount
>by Item" and "Discount General", i need calc the sum of total sales. I use
>the line:
>
>SELECT SUM(b.PrItSale*b.QtItSale-DiscountItSale)-SUM(a.DiscountSale) FROM
>Sale a, ItSale b
>WHERE b.CodSale = a.CodSale
>
>The problem: i give one discount general it repeat the discount for all
>items of sale.
SELECT
a.CodSale,
(SUM(b.PrItSale*b.QtItSale-DiscountItSale)-SUM(a.DiscountSale)) as
SaleValue
FROM Sale a
JOIN ItSale b
ON (b.CodSale = a.CodSale)
GROUP BY a.CodeSale
Daniel Rail
Senior System Engineer
ACCRA Group Inc. (www.accra.ca)
ACCRA Med Software Inc. (www.accramed.ca)