Still learning about subquery design. I've been researching this, and have gotten to this point, unfortunately still have much to learn about this subject
Trying to get count of Acc grouped by Stats that have a balance > 0
and count of Acc grouped by Stats that have a balance <= 0 in the same query.
When I run the SQL it prompts for parameter for A.Acc, A.Stats etc.
Thank you for the assistance.
Trying to get count of Acc grouped by Stats that have a balance > 0
and count of Acc grouped by Stats that have a balance <= 0 in the same query.
When I run the SQL it prompts for parameter for A.Acc, A.Stats etc.
Code:
SELECT
A.Acc,
A.Stats,
A.Bal,
B.Acc,
B.Stats,
B.Bal
FROM [SELECT Count(Acc) AS CntAccLessZero,
Sum(Bal) AS SumBalLessZero
FROM tblAccount
GROUP BY Stats, Bal
]. AS A,
[SELECT Count(Acc) AS CntAccGreaterZero,
Sum(Bal) AS SumBalGreaterZero
FROM tblAccount
GROUP BY Stats, Bal
]. AS B
WHERE (((A.Bal)<=[O]) AND ((B.Bal)>0));