L
Love Buzz
Hi All.
Here is what I am trying to accomplish. I am working with a query pulling
from two tables with a Join Property of DepositAccount. My goal is to show
the total number of 'source' and the total $ of 'ItemAmount' from the
'Incoming Return Item Detail - 2009' table and the total number of '# of
Items' and the total $ of the '$ of Deposit' from the 'Deposit Information'
table. Finally to compare the totals from each table (the expressions).
However, the SQL is returning multiple results per account. I want one
result per DepositAccount with the totals for each.
Any idea where I am going astray? Thanks for your help.
SELECT [Incoming Return Item Detail - 2009].DepositAccount, Count([Incoming
Return Item Detail - 2009].Source) AS CountOfSource, Sum([Incoming Return
Item Detail - 2009].ItemAmount) AS SumOfItemAmount, DepositInformation.[# of
items], DepositInformation.[$ of Deposit], [CountOfSource]/[# of items] AS
Expr1, [SumOfItemAmount]/[$ of Deposit] AS Expr2
FROM [Incoming Return Item Detail - 2009] INNER JOIN DepositInformation ON
[Incoming Return Item Detail - 2009].DepositAccount =
DepositInformation.DepositAccount
WHERE ((([Incoming Return Item Detail - 2009].Date) Between [Start Date] And
[End Date]))
GROUP BY [Incoming Return Item Detail - 2009].DepositAccount,
DepositInformation.[# of items], DepositInformation.[$ of Deposit];
Here is what I am trying to accomplish. I am working with a query pulling
from two tables with a Join Property of DepositAccount. My goal is to show
the total number of 'source' and the total $ of 'ItemAmount' from the
'Incoming Return Item Detail - 2009' table and the total number of '# of
Items' and the total $ of the '$ of Deposit' from the 'Deposit Information'
table. Finally to compare the totals from each table (the expressions).
However, the SQL is returning multiple results per account. I want one
result per DepositAccount with the totals for each.
Any idea where I am going astray? Thanks for your help.
SELECT [Incoming Return Item Detail - 2009].DepositAccount, Count([Incoming
Return Item Detail - 2009].Source) AS CountOfSource, Sum([Incoming Return
Item Detail - 2009].ItemAmount) AS SumOfItemAmount, DepositInformation.[# of
items], DepositInformation.[$ of Deposit], [CountOfSource]/[# of items] AS
Expr1, [SumOfItemAmount]/[$ of Deposit] AS Expr2
FROM [Incoming Return Item Detail - 2009] INNER JOIN DepositInformation ON
[Incoming Return Item Detail - 2009].DepositAccount =
DepositInformation.DepositAccount
WHERE ((([Incoming Return Item Detail - 2009].Date) Between [Start Date] And
[End Date]))
GROUP BY [Incoming Return Item Detail - 2009].DepositAccount,
DepositInformation.[# of items], DepositInformation.[$ of Deposit];