0

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.

1
  • Do UNION ALL, and skip the ORDER BY. Commented Jul 18, 2021 at 20:04

1 Answer 1

1

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]
Sign up to request clarification or add additional context in comments.

1 Comment

I would assume UNION, not UNION ALL.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.