Combining multiple queries

I run the following query on several tables.

SELECT DateSerial(Year([TicketDate]), Month([TicketDate]), 1) AS yyyymm, Count(CumulativeSumProblem.TicketNumber) AS CountOfTicketNumber, 
(Select Count(*) From CumulativeSumProblem As CS Where 
DateSerial(Year(CS.[TicketDate]), Month(CS.[TicketDate]), 1) <= DateSerial(Year(CumulativeSumProblem.[TicketDate]), Month(CumulativeSumProblem.[TicketDate]), 1) ) As CumulativeSum
FROM CumulativeSumProblem
GROUP BY DateSerial(Year([TicketDate]), Month([TicketDate]), 1);

Open in new window


Each table represents a different district/area; and I would like to combine the query results into one big query.

Sometimes I am trying to combine 2 query results, sometimes I combine 3 queries.

How do I go about combing such query results?

Thanks  

Ps. this is done in MS Access.
babble324Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Patrick MatthewsCommented:
If I understand correctly, you want the UNION / UNION ALL operator.  For example, if Region 1 stats are in CumulativeSumProblem and Region 2 stats are in CumulativeSumProblem2:

SELECT "Region 1" AS Region, DateSerial(Year([TicketDate]), Month([TicketDate]), 1) AS yyyymm, Count(CumulativeSumProblem.TicketNumber) AS CountOfTicketNumber, 
(Select Count(*) From CumulativeSumProblem As CS Where 
DateSerial(Year(CS.[TicketDate]), Month(CS.[TicketDate]), 1) <= DateSerial(Year(CumulativeSumProblem.[TicketDate]), Month(CumulativeSumProblem.[TicketDate]), 1) ) As CumulativeSum
FROM CumulativeSumProblem
GROUP BY DateSerial(Year([TicketDate]), Month([TicketDate]), 1)
UNION
SELECT "Region 2" AS Region, DateSerial(Year([TicketDate]), Month([TicketDate]), 1) AS yyyymm, Count(CumulativeSumProblem2.TicketNumber) AS CountOfTicketNumber, 
(Select Count(*) From CumulativeSumProblem2 As CS Where 
DateSerial(Year(CS.[TicketDate]), Month(CS.[TicketDate]), 1) <= DateSerial(Year(CumulativeSumProblem2.[TicketDate]), Month(CumulativeSumProblem2.[TicketDate]), 1) ) As CumulativeSum
FROM CumulativeSumProblem2
GROUP BY DateSerial(Year([TicketDate]), Month([TicketDate]), 1)

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
babble324Author Commented:
Yes sir
Patrick MatthewsCommented:
"Yes sir" as in that's what you needed, or something else?

:)
babble324Author Commented:
That's what I needed. Thanks a lot!
babble324Author Commented:
Actually, since I need this data for an MS graph, is there a way you can have the query results be as following:

Date   RegionOne_Sums RegionTwo_Sums.

that way; the date column is a common factor.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.