G
Guest
I have a simple sum query to sum sales. No need to pay attention to my
criteria expression as it is just narrowing down the selection to one record.
When I take grouping off (no sum), the sales figure is correct. Here is the
SQL for the query:
SELECT T10_Sls_Detail.Month, T10_Sls_Detail.Base_Year,
T10_Sls_Detail.Base_Month, T10_Sls_Detail.Material, T10_Sls_Detail.Sales
FROM T10_Sls_Detail
WHERE (((T10_Sls_Detail.Month)="09") AND ((T10_Sls_Detail.Base_Year)="2007")
AND ((T10_Sls_Detail.Base_Month)="02") AND
((T10_Sls_Detail.Material)="59021467"));
This gives me the correct sales figure, but I need to sum it.
Here is the SQL for the query that sums the sales figure:
SELECT T10_Sls_Detail.Month, T10_Sls_Detail.Base_Year,
T10_Sls_Detail.Base_Month, T10_Sls_Detail.Material, Sum(T10_Sls_Detail.Sales)
AS SumOfSales
FROM T10_Sls_Detail
GROUP BY T10_Sls_Detail.Month, T10_Sls_Detail.Base_Year,
T10_Sls_Detail.Base_Month, T10_Sls_Detail.Material
HAVING (((T10_Sls_Detail.Month)="09") AND
((T10_Sls_Detail.Base_Year)="2007") AND ((T10_Sls_Detail.Base_Month)="02")
AND ((T10_Sls_Detail.Material)="59021467"));
This adds .125 to the sales figure. The query doesn't just add to the sales
figure, however. When I select other material numbers (txt field), it could
be correct or even subtract from the figure. The maximum deviation is .50.
Any help you could provide would be greatly appreciated.
Adam
criteria expression as it is just narrowing down the selection to one record.
When I take grouping off (no sum), the sales figure is correct. Here is the
SQL for the query:
SELECT T10_Sls_Detail.Month, T10_Sls_Detail.Base_Year,
T10_Sls_Detail.Base_Month, T10_Sls_Detail.Material, T10_Sls_Detail.Sales
FROM T10_Sls_Detail
WHERE (((T10_Sls_Detail.Month)="09") AND ((T10_Sls_Detail.Base_Year)="2007")
AND ((T10_Sls_Detail.Base_Month)="02") AND
((T10_Sls_Detail.Material)="59021467"));
This gives me the correct sales figure, but I need to sum it.
Here is the SQL for the query that sums the sales figure:
SELECT T10_Sls_Detail.Month, T10_Sls_Detail.Base_Year,
T10_Sls_Detail.Base_Month, T10_Sls_Detail.Material, Sum(T10_Sls_Detail.Sales)
AS SumOfSales
FROM T10_Sls_Detail
GROUP BY T10_Sls_Detail.Month, T10_Sls_Detail.Base_Year,
T10_Sls_Detail.Base_Month, T10_Sls_Detail.Material
HAVING (((T10_Sls_Detail.Month)="09") AND
((T10_Sls_Detail.Base_Year)="2007") AND ((T10_Sls_Detail.Base_Month)="02")
AND ((T10_Sls_Detail.Material)="59021467"));
This adds .125 to the sales figure. The query doesn't just add to the sales
figure, however. When I select other material numbers (txt field), it could
be correct or even subtract from the figure. The maximum deviation is .50.
Any help you could provide would be greatly appreciated.
Adam