Solved

join multiple query results into 1 query

Posted on 2014-02-05
7
236 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
  • 3
  • 3
7 Comments
 
LVL 19

Expert Comment

by:MINDSUPERB
Comment Utility
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
Comment Utility
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
Comment Utility
Just ignore my post:

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

I missed that part in your question.

Sincerely,

Ed
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 19

Accepted Solution

by:
MINDSUPERB earned 250 total points
Comment Utility
You can create a Crosstab out from the union query.

Ed
0
 

Author Comment

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

Assisted Solution

by:Dale Fye (Access MVP)
Dale Fye (Access MVP) earned 250 total points
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now