Shaon Paul
Shaon Paul

Reputation: 153

Create a new Table in MS Access using an existing SQL query

I have two different tables US and UK in my Access database. I have imported these two tables from two different excel files. Now I am creating a query for Union of these two tables and query runs perfectly. My query is given below:

SELECT ID,Month,Year,Country
From UK
ORDER BY ID;
UNION SELECT ID,Month,Year,Country
From US;

Now I want to create a new Table where the out put of the above query will store. I want to write a SQL code for that. I am totally new in Sql so need help to resolve it.

Upvotes: 0

Views: 2223

Answers (1)

Parfait
Parfait

Reputation: 107642

Simply run a make-table query which involves the INTO clause in MS Access SQL. Also, place UNION query in a subquery derived table:

SELECT ID, [Month], [Year], [Country]
INTO myNewTable
FROM (
    SELECT ID, [Month], [Year], [Country]
    FROM [UK]
    UNION ALL
    SELECT ID, [Month], [Year], [Country] 
    FROM [US]
) sub
ORDER BY [ID]

Upvotes: 1

Related Questions