[英]Create a new Table in MS Access using an existing SQL query
I have two different tables US and UK in my Access database.我的 Access 数据库中有两个不同的表 US 和 UK。 I have imported these two tables from two different excel files.
我已经从两个不同的 excel 文件中导入了这两个表。 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.
我想为此编写一个 SQL 代码。 I am totally new in Sql so need help to resolve it.
我是 Sql 的新手,所以需要帮助来解决它。
Simply run a make-table query which involves the INTO
clause in MS Access SQL.只需在 MS Access SQL 中运行涉及
INTO
子句的生成表查询。 Also, place UNION
query in a subquery derived table:此外,将
UNION
查询放在子查询派生表中:
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]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.