G
Guest
I have a make table query that I use daily. Here is the SQL:
SELECT DISTINCTROW dbo_CheckAggregate.CheckNum AS Expr1,
Sum(dbo_CheckDetail.CkDetailAmt) AS [Sum Of CkDetailAmt] INTO BankOneDeposit
FROM dbo_CheckDetail INNER JOIN dbo_CheckAggregate ON
dbo_CheckDetail.CkDetailAggID = dbo_CheckAggregate.CheckAggID
WHERE (((dbo_CheckAggregate.CheckDateRecd)=[Enter Date you want output for])
AND ((dbo_CheckDetail.ckWF)=0))
GROUP BY dbo_CheckAggregate.CheckNum;
Normally, this works fine. The problem is on occasion, the CheckNum field
is NOT a unique value. When this happends, my query combines the total of
two checks into one amount (its a SUM, and the aggregate function is GROUP
BY, so I understand WHY its doing what its doing).
So, I basically don't want to GROUP BY the CheckNum field. But I can't get
any alternative to work where I am not grouping by SOMETHING. Any ideas?
SELECT DISTINCTROW dbo_CheckAggregate.CheckNum AS Expr1,
Sum(dbo_CheckDetail.CkDetailAmt) AS [Sum Of CkDetailAmt] INTO BankOneDeposit
FROM dbo_CheckDetail INNER JOIN dbo_CheckAggregate ON
dbo_CheckDetail.CkDetailAggID = dbo_CheckAggregate.CheckAggID
WHERE (((dbo_CheckAggregate.CheckDateRecd)=[Enter Date you want output for])
AND ((dbo_CheckDetail.ckWF)=0))
GROUP BY dbo_CheckAggregate.CheckNum;
Normally, this works fine. The problem is on occasion, the CheckNum field
is NOT a unique value. When this happends, my query combines the total of
two checks into one amount (its a SUM, and the aggregate function is GROUP
BY, so I understand WHY its doing what its doing).
So, I basically don't want to GROUP BY the CheckNum field. But I can't get
any alternative to work where I am not grouping by SOMETHING. Any ideas?