Union Query

crcastilla

Registered User.
Local time
Yesterday, 19:30
Joined
Aug 20, 2011
Messages
21
So I'm trying to put multiple queries into one table. What's the the code I have to use?
I used the following:

SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [#2 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [B-1901 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [Hemco#2 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [Hemco001 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [Hemco49308-02#1 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [Hemco49308-02#2 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [HemcoC-48 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [HemcoPO-1 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [B-1901 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [Hemco#2 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [Hemco001 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [Hemco49308-02#1 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [Hemco49308-02#2 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [HemcoC-48 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [HemcoPO-1 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-24594 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-25410 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-25413 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-25414 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-25415 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-25425 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-25427 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-25428 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-25429 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-25430 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-25441 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-25451 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-25453 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-25455 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-25496 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-25816 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-25822 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-25823 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-25828 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-25834(Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-25835(Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-25840 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-25841 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-25846 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-25853 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-25858 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-25860 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-25864 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-25871 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-28560 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-28858 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-28859 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-31992 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-35230 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-35866 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-36317 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-38555 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-39803 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-40345 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-40379 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-40476 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-40542 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-40572 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-40584 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-40590 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-40625 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-41035 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-41886 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-41887 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-41888 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-41890 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-43222 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-43834 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-45996 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-45997 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-47267 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-47991 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-47992 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-47993 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-48046 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-48188 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-48189 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-48190 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-48191 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-48280 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-51446 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-54860 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-54861 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-55541 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-55542 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-55543 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-55850 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-58305 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-58462 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-59782 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-59783 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-60165 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-60166 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-60167 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-60597 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-61527 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-61528 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-61943 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-64888 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-66439 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-808967 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-83 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [P-84 (Q)]
UNION ALL
SELECT SN, GageDescription, CalibrationTolerances, S1, A, S, SO, Tolerance, By, Date, Due, Temperature
FROM [SD-M22505 (Q)];

but it pops the following error:
Microsoft Office Access engine could not find the object ". Make sure the object exists and that you spell its name and the path name correctly.

Please anyone help/
Thank you
 
First off - Why in the world do you have so many QUERIES to pull from? What is the purpose behind having so many queries with the same fields?

Do you have multiple tables with the same fields too?
 
Last edited:
I know it's a hell lot 96, I think. I know there was a better way to do it but I wanted to try this. I know it but I would like to know if the code is correct or if it is missing something I will appreciate it so muchh. Thank you again
 
I'm not finding anything definitive or that I trust as 100% credible, but I've found some citations of limits to the number of fields (255) and tables (32) you can have in your query. Maybe you can test this by cutting your query down to 33 tables, 32 tables and 31 tables to see if it runs at any of those.

If it still doesn't run at 31 tables try cutting it down to 22 and 21 tables to see if the field limit is in fact 255. (12 fields per query gives 264 fields at 22 tables and 252 fields at 21 tables).

All in all though, Bob's right -- this Frankenquery you're trying to bring to life is indicative of bigger problems with your table/query structure.
 
I know it's a hell lot 96, I think. I know there was a better way to do it but I wanted to try this. I know it but I would like to know if the code is correct or if it is missing something I will appreciate it so muchh. Thank you again

You didn't answer my questions.
boblarson said:
Why in the world do you have so many QUERIES to pull from? What is the purpose behind having so many queries with the same fields?
 
I agree with the others in that your design is incorrect.

But if this is truely an exercise to learn Union Queries start small. Use only 2 or 3 tables first.

PS "Date" is a reserved word and should not be used. Try "MyDate" of similar.
 

Users who are viewing this thread

Back
Top Bottom