COMBINING QUERIES

Hello,

I currently have two queries in Access each containing two columns of data headed with the same names, "Instruments" and "Currency". What I would like to do is to combine the relevant columns of data so that a new query is created showing a single column of "Instruments" and "Currency".

Regards,

f19l
f19lAsked:
Who is Participating?
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.

ee_rleeCommented:
try this

SELECT table1.Instruments, table1.Currency
FROM table1 INNER JOIN table2 ON ((table1.Instruments=table2.Instruments) AND (table1.Currency=table2.Currency))
0
dqmqCommented:
Problem is, we can only guess what you mean by "combine".  Please show your existing queries and what you want the output to look like.

One way to combine them is like this:

Select * from Qyery1
union
Select * from Query2

But, I give it a 10% chance that is what you want.  
0
Shanmuga SundaramDirector of Software EngineeringCommented:
or else you can also use as

select * from instruments a, currency b where a.uniquefieldname=b.uniquefieldname.

Eg. Select * from instruments a, currency b where a.instrumentsid = b.instrumentsid
0
f19lAuthor Commented:
Okay, below is a small extract from the two queries and what I would ultimately like to see:

Query 1                                                      Query 2

Instruments              Currency                   Instruments              Currency
GBP GBLI/LF            GBP                           IBK FOAS/USD         USD
GBP_O/N_SONIA     GBP                           NACN F 040109        EUR

"Combined Query"

Instruments              Currency
GBP GBLI/LF            GBP
GBP_O/N_SONIA     GBP
IBK FOAS/USD         USD
NACN F 040109        EUR

As you can see I would like to join the data within each respective column in the new query. Note that there maybe cases that there is a duplication of data but that is not a problem since I will simply use the 'group by' function. Hopefully this will clear things up for you. Please note that I have very little in the way of Access knowledge so you will have to take me through the solution step-by-step.

Regards,

f19l
0
dqmqCommented:
You do NOT want a join.  You do NOT need a group by.  Just do this:

Select * from Query1
union
Select * from Query2

or this:

Select Instruments, Currency From YourTable1
Union
Select Instruments, Currency From YourTable2


In other words, just union your existing queries.
0

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
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
Visual Basic Classic

From novice to tech pro — start learning today.