Summing 2 values in a report

Goldie9

New member
Local time
Today, 06:09
Joined
Dec 14, 2010
Messages
6
I am running a real estate report that has 2 seperate queries. The commission calculated when I am the Listing agent and another when I am the Buyers agent. I can run the queries to get the sums for each query but would liek to run a query that totals the sum for both. OR in a report allows me to add the sums together.
 
Can you post the 2 queries that are involved?
 
Buyer Query
Buyer Agent
co Buyer Agent
Commission
Street Name

Listing Query
Listing Agent
Co Listing agent
Commission
Street Name
 
A query that would sum the commissions together would look something like this.

SELECT Sum(SumTotal) AS SumGrandTotal FROM
(SELECT Sum(Commision) AS SumTotal FROM BuyerQuery
UNION SELECT
Sum(Commission) AS SumTotal FROM SellerQuery)
AS tblCommissions;
 
I am getting several Syntax errors. Actually query names are Buyer Sales Comparison and Listing Sales Comparison.

Do I need to create a table Commissions or will the Union create it when I run it. (First time using "UNION"
 
SELECT Sum(SumTotal) AS SumGrandTotal FROM
(SELECT Sum(Commission) AS SumTotal FROM Buyer Sales Comparison
UNION SELECT
Sum(Commission) AS SumTotal FROM Listing Sales Comparison)
AS tblCommissions;

I created a new table ALL SALES and appended the 2 queries into that table and seems to work.
 

Users who are viewing this thread

Back
Top Bottom