Union Querys

S

Simon

I have the following Union Query that works fine

SELECT qryHotTubs.[IDNumber] AS IDNumber,
qryHotTubs.[ProductName] AS ProductName,
qryHotTubs.[Price] AS Price,
qryHotTubs.[ProductCode] As ProductCode,
'qryHotTubs' AS TheType
FROM qryHotTubs

UNION ALL SELECT qryProducts.[IDNumber] AS IDNumber,
qryProducts.[ProductName] AS ProductName,
qryProducts.[Price] AS Price,
qryProducts.[ProductCode] AS ProductCode,
'qryProduct' AS TheType
FROM qryProducts
ORDER BY IDNumber;




I would now like to add another query to this one but im not sure how
to write this in and where to write it

The information that need to be added to the abover query is

qryExtras.[.[IDNumber] AS IDNumber,
qryExtras.[ProductName] AS ProductName,
qryExtras.[.[Price] AS Price,
qryExtras.[.[ProductCode] AS ProductCode,
qryExtras.[AS TheType
FROM qryExtras



Thanks
 
A

Arvin Meyer [MVP]

Just like you did the first one, move the Order By clause to the end:

SELECT qryHotTubs.[IDNumber] AS IDNumber,
qryHotTubs.[ProductName] AS ProductName,
qryHotTubs.[Price] AS Price,
qryHotTubs.[ProductCode] As ProductCode,
'qryHotTubs' AS TheType
FROM qryHotTubs

UNION ALL SELECT qryProducts.[IDNumber] AS IDNumber,
qryProducts.[ProductName] AS ProductName,
qryProducts.[Price] AS Price,
qryProducts.[ProductCode] AS ProductCode,
'qryProduct' AS TheType
FROM qryProducts

UNION ALL SELECT qryExtras.[.[IDNumber] AS IDNumber,
qryExtras.[ProductName] AS ProductName,
qryExtras.[.[Price] AS Price,
qryExtras.[.[ProductCode] AS ProductCode,
qryExtras.[AS TheType
FROM qryExtras
ORDER BY IDNumber;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Union Qury 1
Union Query 2
Union Query problem 5
Adding data to Subform and save and running a total price calc 0
Blank Fields in Report 2
DLookUp #Error 7
Combo boxes 3
Referring to control on subform 3

Top