Subject | Re: [IBO] SQL Problems |
---|---|
Author | Alcir |
Post date | 2002-04-03T19:44:10Z |
Don't Right, i want group sum in unic value, one register and one field.
But, thanks for try help me.
Alcir
But, thanks for try help me.
Alcir
----- Original Message -----
From: "Daniel Rail" <daniel@...>
To: <IBObjects@yahoogroups.com>
Sent: Wednesday, April 03, 2002 3:34 PM
Subject: Re: [IBO] SQL Problens
> At 03/04/2002 11:36 AM, you wrote:
> >Hi,
> >
> >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.
>
> Try this statement:
>
> 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)
>
>
>
>
___________________________________________________________________________
> IB Objects - direct, complete, custom connectivity to Firebird or
InterBase
> without the need for BDE, ODBC or any other layer.
>
___________________________________________________________________________
> http://www.ibobjects.com - your IBO community resource for Tech Info
papers,
> keyword-searchable FAQ, community code contributions and more !
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>