Aggregate function, Grouping
- From: Kim S <ks@xxxxxxxxxxxxxxx>
- Date: Fri, 19 May 2006 12:32:03 +0200
When I try to execute the sql statement:
SELECT
bl.GR_KEY, bl.GroupOrder, bl.UseOverhead,
SUM (Amount * price) as "SubTotal",
IIF (bl.UseClientAmount = True,
bl.Amount + bl.ClientAmount,
bl.Amount) as "RealAmount"
FROM
Budget_Lines bl
GROUP BY
bl.BU_KEY, bl.GroupOrder, bl.UseOverhead, bl.GR_KEY
HAVING
bl.BU_KEY = :BU_KEY
I get an exception, because the Group By fields do not match the Select fields.
But if I include the fields:
GROUP BY
bl.BU_KEY, bl.GroupOrder, bl.UseOverhead, bl.GR_KEY,
bl.UseClientAmount, bl.Amount, bl.ClientAmount
- the result is wrongly grouped. Can I avoid this problem?
Regards,
Kim
.
- Follow-Ups:
- Re: Aggregate function, Grouping
- From: Vitali Kalinin
- Re: Aggregate function, Grouping
- From: Michael Jacobs
- Re: Aggregate function, Grouping
- Prev by Date: Re: Flow Control in Access?
- Next by Date: Re: Aggregate function, Grouping
- Previous by thread: Flow Control in Access?
- Next by thread: Re: Aggregate function, Grouping
- Index(es):
Relevant Pages
|