ACC: How to Create a Make-Table Query with a Union QueryID: Q132070
|
Moderate: Requires basic macro, coding, and interoperability skills.
Microsoft Access SQL does not allow you to use the INTO clause (a clause
needed to create a make-table query) within a union query. Therefore, you
cannot directly create a make-table query; you must first create a union
query, and then use the results of that query in the make-table query. This
article demonstrates how to do so.
NOTE: A demonstration of the technique used in this article can be seen
in the sample file, Qrysmp97.exe. For information about how to obtain
this sample file, please see the following article in the Microsoft
Knowledge Base:
Q182568 ACC97: Microsoft Access 97 Sample Queries Available on
MSL
In order to create a table from a union query, you must first define the
union query, and then create a make-table query based upon the union query
results. To do so, follow these steps.
CAUTION: Following the steps in this example will modify the sample
database Northwind.mdb (or the NWIND.MDB in version 2.0). You may want to
back up the Northwind.mdb or NWIND.MDB file or perform these steps on a
copy of these databases.
SELECT CompanyName, City, "Customers" as [Relationship]
FROM Customers
WHERE Country = "Brazil"
UNION SELECT CompanyName, City, "Suppliers"
FROM Suppliers
WHERE Country = "Brazil";
For more information about union queries, search the Help Index for
"union queries," or ask the Microsoft Access 97 Office Assistant.
For more information about make-table queries, search the Help Index for
"make-tables," or ask the Microsoft Access 97 Office Assistant.
Keywords : QryUnion QryMktbl
Version : 2.0 7.0 97
Platform : WINDOWS
Issue type : kbhowto
Last Reviewed: April 20, 1999