simsima_7876
asked on
Sum the values from 2 different queries in 1 query
Hi Experts
I have the 2 queries below, each of which gives me one number. I want to be able to create a query which uses these 2 queries as subqueries so the 2 values can be summed and I have one total. Can you help?
SELECT Sum([Pnl by GL - Accounting result].[SumOf7 Total Pnl YTD]) AS GL_ACCOUNTING
FROM [Pnl by GL - Accounting result]
WHERE ((([Pnl by GL - Accounting result].ReportCategory)="H TM" Or ([Pnl by GL - Accounting result].ReportCategory)="L oans&Recei vables") AND (([Pnl by GL - Accounting result].AcctArea)="BA_AMAD EUS" Or ([Pnl by GL - Accounting result].AcctArea)="BA_TOP_ UP" Or ([Pnl by GL - Accounting result].AcctArea)="BA_CDS_ HDG" Or ([Pnl by GL - Accounting result].AcctArea)="HENDERS ON") AND (([Pnl by GL - Accounting result].AccountCode)=58650 00000));
and
SELECT Sum([PnL by GL - Interest].[SumOf11 TotalInterest]) AS GL_INTEREST
FROM [PnL by GL - Interest]
WHERE ((([PnL by GL - Interest].ReportCategory)= "Loans&Rec eivables" Or ([PnL by GL - Interest].ReportCategory)= "HTM") AND (([PnL by GL - Interest].AcctArea)="BA_AM ADEUS" Or ([PnL by GL - Interest].AcctArea)="BA_TO P_UP" Or ([PnL by GL - Interest].AcctArea)="BA_CD S_HDG" Or ([PnL by GL - Interest].AcctArea)="HENDE RSON"));
I have the 2 queries below, each of which gives me one number. I want to be able to create a query which uses these 2 queries as subqueries so the 2 values can be summed and I have one total. Can you help?
SELECT Sum([Pnl by GL - Accounting result].[SumOf7 Total Pnl YTD]) AS GL_ACCOUNTING
FROM [Pnl by GL - Accounting result]
WHERE ((([Pnl by GL - Accounting result].ReportCategory)="H
and
SELECT Sum([PnL by GL - Interest].[SumOf11 TotalInterest]) AS GL_INTEREST
FROM [PnL by GL - Interest]
WHERE ((([PnL by GL - Interest].ReportCategory)=
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER