saving the results of queries

D

Dave Kaplan

I have developed a union query in SQL that returns well over 100,000 records
and involves 7 tables (see below). Copying and pasting is impossible, and I
would like to be able to save the query as a table (like in Make Table).
How do I go about doing this? Thanks

My SQL looks like this:

SELECT [PARCEL_ID],[CITY], [ADDRESS], [Sale_Amt], [Mgt_Amt], [LAND_USAGE],
[SALE_DATE], [MORTGAGE_DATE]
FROM [Akron1]
WHERE [O_R_B] = "R" and [OWNER_OCCUPIED] = "Yes"
UNION
SELECT [PARCEL_ID], [CITY], [ADDRESS], [Sale_Amt], [Mgt_Amt], [LAND_USAGE],
[SALE_DATE], [MORTGAGE_DATE]
FROM [Akron2]
WHERE [O_R_B] = "R" and [OWNER_OCCUPIED] = "Yes"
UNION
SELECT [PARCEL_ID], [CITY], [ADDRESS], [Sale_Amt], [Mgt_Amt], [LAND_USAGE],
[SALE_DATE], [MORTGAGE_DATE]
FROM [Akron3]
WHERE [O_R_B] = "R" and [OWNER_OCCUPIED] = "Yes"
UNION
SELECT [PARCEL_ID],[CITY], [ADDRESS],[Sale_Amt],[Mgt_Amt], [LAND_USAGE],
[SALE_DATE], [MORTGAGE_DATE]
FROM [Aur_Copley]
WHERE [O_R_B] = "R" and [OWNER_OCCUPIED] = "Yes"
UNION
SELECT [PARCEL_ID],[CITY], [ADDRESS],[Sale_Amt],[Mgt_Amt], [LAND_USAGE],
[SALE_DATE], [MORTGAGE_DATE]
FROM [Cuyah_Monroe]
WHERE [O_R_B] = "R" and [OWNER_OCCUPIED] = "Yes"
UNION
SELECT [PARCEL_ID],[CITY], [ADDRESS],[Sale_Amt],[Mgt_Amt], [LAND_USAGE],
[SALE_DATE], [MORTGAGE_DATE]
FROM [NoCanton_Tallmadge]
WHERE [O_R_B] = "R" and [OWNER_OCCUPIED] = "Yes"
UNION SELECT [PARCEL_ID],[CITY],[ADDRESS],[Sale_Amt],[Mgt_Amt],
[LAND_USAGE], [SALE_DATE], [MORTGAGE_DATE]
FROM [Twins_Wads]
WHERE [O_R_B] = "R" and [OWNER_OCCUPIED] = "Yes";
 
K

KARL

Add INTO MyResults in your SQL as below.

SELECT [PARCEL_ID],[CITY], [ADDRESS], [Sale_Amt],
[Mgt_Amt], [LAND_USAGE], [SALE_DATE], [MORTGAGE_DATE]
FROM [Akron1] INTO MyResults
 
J

John Vinson

Copying and pasting is impossible, and I
would like to be able to save the query as a table (like in Make Table).

Base a MakeTable query on the Union query. You don't have to base a
query directly on a Table - it can be based on another Query.
 
D

Dave Kaplan

Thanks -- that works well.


John Vinson said:
Base a MakeTable query on the Union query. You don't have to base a
query directly on a Table - it can be based on another Query.
 

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


Top