Solved

join multiple query results into 1 query

Posted on 2014-02-05
7
238 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
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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
LVL 19

Accepted Solution

by:
MINDSUPERB earned 250 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 47

Assisted Solution

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
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 …

863 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

18 Experts available now in Live!

Get 1:1 Help Now