Simple union query issue

DAW

Registered User.
Local time
Today, 11:24
Joined
Mar 22, 2006
Messages
70
The answer to this must be simple, but highlights my lack of knowledge of union queries - help guys!

I have a table with two price lists in it, say 2007 and 2008 price lists. I have two queries (for simpicity) that pull the data into seperate entities, one for each price list. I want to compare the prices from 2007 and 2008. The price list for 07 may have parts in that are not in 08 and vide versa.

I have the following union query that works-ish. The problem is that whereas I get the two columns of prices as required, they are stacked, not side by side.
i.e. I get:
Price - Null
...
then:
Null - Price
...

Code:
SELECT PartNo,Description,Price as S1,Null as S2 from qry_Set1;
UNION ALL 
SELECT PartNo,Description,Null as S1,Price as S2 from qry_Set2;

How do I get them side by side?
 
a union does stack them

instead of unioning your queries, just have a third query using both your queries, and pull the fields in.

the only thing is, you need a master parts list, so you can get the nulls from priceset1 AND priceset2 - if you just have priceset1 and priceset2, whichever way you set the join, you will lose unmatched items from one side or other
 
Ahhh... I understand your thinking. Thanks for the reply.

So I make a dataset of the two tables to get all the part numbers then add queries based on that.
 

Users who are viewing this thread

Back
Top Bottom