动态重命名列

时间:2014-05-29 11:45:52

标签: sql ms-access-2007

我正在使用MS ACCESS 2007.我有以下查询: -

Select 
    [table1.column1] as [week 1], 
    [table1.column2] as [week 2], 
    [table1.column3] as [week 3] 
FROM [table1];

我有一个包含两列的主表,其中包含id(值为1,2,3)和names(值为column1_name,column2_name,column3_name)

是否可以从主表中更改列名?

我希望[table1.column1]标题为column1_name,依此类推。

2 个答案:

答案 0 :(得分:1)

为什么不在查询中提供列别名,如

SELECT [table1.column1] AS column1_name , [table1.column2] AS column2_name, 
       [table1.column3] AS column3_name 
FROM MASTERTABLE

答案 1 :(得分:0)

听起来你应该使用数据透视表视图...这可能会做你想要的。