?
Solved

join multiple query results into 1 query

Posted on 2014-02-05
7
Medium Priority
?
250 Views
Last Modified: 2014-02-06
hey guys, i have 3 complex queries and they each give me just 1 value

so for example

Query 1: Output result --> 137
Query 2: Output result --> 33
Query 3: Output result --> 104

there is only 1 cell for each of the output results

Question: how do i join these into 1 resultant queries with 3 cells in 1 row?

i was thinking of using a union query but i don't think that will work as i am trying to add columns instead of rows

i was thinking about outer join but i don't have a unique key

the only way i can think of so far is to write it to a temporary table and then do a select query from there.

thanks in advance guys!
0
Comment
Question by:developingprogrammer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 19

Expert Comment

by:MINDSUPERB
ID: 39838031
Hello developingprogrammer,

In my opinion, a union query will suffice with your requirement. You can design it using a sample below:


SELECT DISTINCT tblSample.TestField
FROM tblSample
WHERE (((tblSample.TestField)="Emp1"))

UNION ALL

SELECT DISTINCT tblSample.TestField
FROM tblSample
WHERE (((tblSample.TestField)="Emp2"))

UNION ALL

SELECT DISTINCT tblSample.TestField
FROM tblSample
WHERE (((tblSample.TestField)="Emp3"));


Sincerely,

Ed
0
 

Author Comment

by:developingprogrammer
ID: 39838082
hi Ed, thanks for your response!

so the result would be 1 column with 3 rows is that correct?

let's say just for moot i really need 3 columns in 1 row, how can i achieve that? thanks! = )
0
 
LVL 19

Expert Comment

by:MINDSUPERB
ID: 39838097
Just ignore my post:

"as i am trying to add columns instead of rows"

I missed that part in your question.

Sincerely,

Ed
0
Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

 
LVL 19

Accepted Solution

by:
MINDSUPERB earned 1000 total points
ID: 39838104
You can create a Crosstab out from the union query.

Ed
0
 

Author Comment

by:developingprogrammer
ID: 39838110
whao i didn't think of that. ok i need to go and read up on crosstab queries. good idea, thanks Ed!
0
 
LVL 48

Assisted Solution

by:Dale Fye
Dale Fye earned 1000 total points
ID: 39838479
Actually, you could simply try:

Select qry1.Field1, qry2.Field1, qry3.Field1
FROM qry1, qry2, qry3

This is a Cartesian join, all combinations of all records from all queries.
0
 

Author Comment

by:developingprogrammer
ID: 39840875
whao Dale, that is a fantastic idea! i really like your idea and i also really like Ed's idea. they both serve different purposes and in this case both work. thanks so much for chipping in Dale! = )
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question