I have created a Union query and I need to sum the amounts where the tblDraws_Details1.ID = tblRepayments.DrawIDrpmt
I know that I need to group based on the ID and how to do this in SQL is escaping me.
I am greatful for you help.
Please see attached union query and I think you can see what I am trying to do. You can see it is sorted on ID and I need to Group those IDs and the sum will return.
here is the sql as I have it:
SELECT tblDraws_Details1.ID, Sum(tblDraws_Details1.Amou
nt) AS SumOfAmount, "" as PaymentMadeDummy
GROUP BY tblDraws_Details1.ID
UNION ALL SELECT tblRepayment.DrawIDrpmt, Sum(tblRepayment.Amount) AS SumOfAmount, tblRepayment.PaymentMadeYN
GROUP BY tblRepayment.DrawIDrpmt, tblRepayment.PaymentMadeYN