Creating one table from data of another table in Access

一笑奈何 提交于 2019-12-30 12:38:21

问题


This question is regarding MS Access.

What I'm trying to do is that I have one table in Access, and would like to create another table (hopefully automatically through some VBA code) using data from the first table.

Is there any suggestion on how to do this? I'm quite new in VBA and Access so any detailed help would be appreciated (or direction on where to go).

Original Table (table 1 Data):

Original Table (table 1 structure):

Table 2 Data:

Table 2 Structure:


回答1:


No VBA is needed. A UNION query can rearrange the data. There is no wizard or designer for UNION query, type or copy/paste in SQLView of query builder. Also, there is a limit of 50 SELECT lines.

SELECT ID AS IDFromTable1, EmployeeName, Ford AS CarManufacturer FROM Table1
UNION SELECT ID, EmployeeName, Mazda FROM Table1
UNION SELECT ID, EmployeeName, Honda FROM Table1
UNION SELECT ID, EmployeeName, Toyota FROM Table1
UNION SELECT ID, EmployeeName, Audi FROM Table1
UNION SELECT ID, EmployeeName, Volkswagon FROM Table1
UNION SELECT ID, EmployeeName, BMW FROM Table1
UNION SELECT ID, EmployeeName, Benz FROM Table1;


来源:https://stackoverflow.com/questions/48030295/creating-one-table-from-data-of-another-table-in-access

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!