pdvsa
asked on
Union Query Help - Sum on IDs
Experts,
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
FROM tblDraws_Details1
GROUP BY tblDraws_Details1.ID
UNION ALL SELECT tblRepayment.DrawIDrpmt, Sum(tblRepayment.Amount) AS SumOfAmount, tblRepayment.PaymentMadeYN
FROM tblRepayment
GROUP BY tblRepayment.DrawIDrpmt, tblRepayment.PaymentMadeYN
HAVING (((tblRepayment.PaymentMad eYN)="Yes" ));
Summing.accdb
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
FROM tblDraws_Details1
GROUP BY tblDraws_Details1.ID
UNION ALL SELECT tblRepayment.DrawIDrpmt, Sum(tblRepayment.Amount) AS SumOfAmount, tblRepayment.PaymentMadeYN
FROM tblRepayment
GROUP BY tblRepayment.DrawIDrpmt, tblRepayment.PaymentMadeYN
HAVING (((tblRepayment.PaymentMad
Summing.accdb
ASKER
I think you need the same as in your other question: a query that use the above query as source, then group by ID and sum SumAmounts.
/gustav
/gustav
ASKER
queries like that are beyond my skills. I will keep the question open for a bit and maybe i will get lucky.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Perfect. Thanks for hanging in there. I need to take a break.
You are welcome!
/gustav
/gustav
Open in new window
/gustav