If I have two different queries that produce similar data, how do I join the results ? The resulting query does not produce the "Abbreviation" column which is produced by Query 1. Also, the Resulting query has unique data from both columns. How can I do
this? Should I use a UNION ?
I know I am speaking in general terms here. possibly someone can give me an idea of what I need to do?
Query 1:
ID Restaurant Abreviation
1 Taco Bell TB
2 Bonanza Steak House BH
3 Burger King BK
4 Kentucky Fried Chicken KFC
Query 2:
1 Burger King
2 Bonanza Steak House
5 Pizza Hut
6 McDonalds
Resulting Query :
1 Taco Bell
2 Bonanza Steak House
3 Burger King
4 Kentucky Fried Chicken
5 Pizza Hut
6 McDonalds
AppDevForMe
Participant
1394 Points
1327 Posts
Combining query data ?
Aug 03, 2012 03:24 AM|LINK
If I have two different queries that produce similar data, how do I join the results ? The resulting query does not produce the "Abbreviation" column which is produced by Query 1. Also, the Resulting query has unique data from both columns. How can I do this? Should I use a UNION ?
I know I am speaking in general terms here. possibly someone can give me an idea of what I need to do?
Query 1:
ID Restaurant Abreviation
1 Taco Bell TB
2 Bonanza Steak House BH
3 Burger King BK
4 Kentucky Fried Chicken KFC
Query 2:
1 Burger King
2 Bonanza Steak House
5 Pizza Hut
6 McDonalds
Resulting Query :
1 Taco Bell
2 Bonanza Steak House
3 Burger King
4 Kentucky Fried Chicken
5 Pizza Hut
6 McDonalds
suthish nair
All-Star
15176 Points
3304 Posts
Re: Combining query data ?
Aug 03, 2012 03:29 AM|LINK
You can UNION it, and give an extra column for second query which returns null/blank record.
My Blog
GmGregori
Contributor
5448 Points
736 Posts
Re: Combining query data ?
Aug 03, 2012 07:13 AM|LINK
A simple query like this
should accomplish your goal.
wmec
Contributor
6224 Points
3221 Posts
Re: Combining query data ?
Aug 03, 2012 07:43 AM|LINK
Try
-- Query 1
select ID, restaurant
from tab1
where ...
union
-- Query 2
select ID, restaurant
from tab2
where ...
HuaMin Chen