Dylan Kramer
Dylan Kramer

Reputation: 21

Combining queries that have the same data

I have an access database that was not built correctly and now I'm trying to retrieve data out of it. Basically I have 3 Maj Event Queries and I just need to "stack" the three queries on top of each other. I have run 3 queries to get all the field names to line up but now I am stuck. The three queries have the same fields but different data. I want to make all the queries appear as one. Query 1 has 45,213 records, query 2 has 16,492 and query 3 has 3,592 so I need a Summary query that has all 65,298 records in it. I hope this makes sense and thank you in advance.

enter image description here

Upvotes: 0

Views: 52

Answers (1)

JNevill
JNevill

Reputation: 50034

"Stacking" queries is called a "UNION". Assuming that each view has the exact same columns and each column is the same type, you write a union like:

 SELECT f1, f2, f3 FROM query_1
 UNION ALL 
 SELECT f1, f2, f3 FROM query_2
 UNION ALL
 SELECT f1, f2, f3 from query_3;

Upvotes: 1

Related Questions