don't want to Group BY

  • Thread starter Thread starter Guest
  • Start date Start date
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?
 
Try this --
SELECT DISTINCTROW dbo_CheckAggregate.CheckNum, dbo_CheckDetail.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));
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Top 3 per group 3
Subquery group by 4
Need help with Group By Total 7
Summarizing quantities by Part Number 3
Group By Desing View 4
Grouping Expression 2
sum of a group by... 7
Calculate after Grouping 1

Back
Top