PDA

View Full Version : [SOLVED:] ACCESS SQL SUM FUNCTION ERROS OUT



cleteh
07-19-2016, 04:38 AM
SELECT File_No.FileNo, File_No.CREDTR_NAME, File_No.FORWRD_NAME, File_No.DEBTR_NAME, File_No.BegBalance, SUM(CheckPayments.Amount) AS TotalPayments, TotalInterest.TotInt, File_No.BegBalance+TotalInterest.TotInt-CheckPayments.Amount AS EndBal
FROM (File_No INNER JOIN CheckPayments ON File_No.FileNo = CheckPayments.FileNo) INNER JOIN TotalInterest ON CheckPayments.FileNo = TotalInterest.FileNo
GROUP BY File_No.FileNo, File_No.CREDTR_NAME, File_No.FORWRD_NAME, File_No.DEBTR_NAME, File_No.BegBalance, SUM(CheckPayments.Amount) AS TotalPayments, TotalInterest.TotInt, File_No.BegBalance+TotalInterest.TotInt-CheckPayments.Amount AS EndBal;

I also tried it this way but it then says it errors out on the FROM line

SELECT File_No.FileNo, File_No.CREDTR_NAME, File_No.FORWRD_NAME, File_No.DEBTR_NAME, File_No.BegBalance, SUM(AMOUNT) AS [TotalPayments] FROM [Check Payments], TotalInterest.TotInt, File_No.BegBalance+TotalInterest.TotInt-CheckPayments.Amount AS EndBal
FROM (File_No INNER JOIN CheckPayments ON File_No.FileNo = CheckPayments.FileNo) INNER JOIN TotalInterest ON CheckPayments.FileNo = TotalInterest.FileNo
GROUP BY File_No.FileNo, File_No.CREDTR_NAME, File_No.FORWRD_NAME, File_No.DEBTR_NAME, File_No.BegBalance, SUM(AMOUNT) AS [TotalPayments] FROM [Check Payments], TotalInterest.TotInt, File_No.BegBalance+TotalInterest.TotInt-CheckPayments.Amount AS EndBal;

cleteh
07-19-2016, 04:47 AM
USED QUERY BUILDER THE CODE BELOW WORKS

SELECT File_No.FileNo, File_No.CREDTR_NAME, File_No.FORWRD_NAME, File_No.DEBTR_NAME, File_No.BegBalance, Sum(CheckPayments.Amount) AS SumOfAmount, TotalInterest.TotInt, File_No.BegBalance+TotalInterest.TotInt-CheckPayments.Amount AS EndBal
FROM (File_No INNER JOIN CheckPayments ON File_No.FileNo = CheckPayments.FileNo) INNER JOIN TotalInterest ON CheckPayments.FileNo = TotalInterest.FileNo
GROUP BY File_No.FileNo, File_No.CREDTR_NAME, File_No.FORWRD_NAME, File_No.DEBTR_NAME, File_No.BegBalance, TotalInterest.TotInt, File_No.BegBalance+TotalInterest.TotInt-CheckPayments.Amount;