我有下表:
Source Plate1 Plate2 Plate3 Plate4
我想转换到这个表:
Source Plate1
Source plate2
source Plate3
source Plate4
所以基本上将4 Plate字段中的所有数据附加到1列
我如何在ms access中执行此操作?
感谢
答案 0 :(得分:3)
您可以使用Union查询,例如:
INSERT INTO NewTable (Source, Plate)
SELECT Source, Plate FROM
(SELECT Source, Plate1 As Plate FROM Table
UNION ALL
SELECT Source, Plate2 As Plate FROM Table
UNION ALL
SELECT Source, Plate3 As Plate FROM Table
UNION ALL
SELECT Source, Plate4 As Plate FROM Table) As t
编辑:联盟本身就是:
SELECT Source, Plate1 As Plate FROM Table
UNION ALL
SELECT Source, Plate2 As Plate FROM Table
UNION ALL
SELECT Source, Plate3 As Plate FROM Table
UNION ALL
SELECT Source, Plate4 As Plate FROM Table
或者
SELECT Source, Plate FROM
(SELECT Source, Plate1 As Plate FROM Table
UNION ALL
SELECT Source, Plate2 As Plate FROM Table
UNION ALL
SELECT Source, Plate3 As Plate FROM Table
UNION ALL
SELECT Source, Plate4 As Plate FROM Table) As s