MS在MS Access中的多个字段上的数据透视表

时间:2014-05-05 02:24:15

标签: sql ms-access

我有以下代码以下列格式返回结果。

Name|Col1|Col2

代码

strSql = "TRANSFORM First([type.Value])) AS FirstOfValue" & _
" SELECT [Name] " & _
" FROM" & _
"(" & _
    " SELECT * " & _
    " FROM (table1 as o" & _
           " INNER JOIN table2 as type" & _
             " ON o.ID = type.ID)" & _
             " WHERE ObjectType = 'N'" & _
")" & _
" GROUP BY [Name]" & _
" PIVOT [type.Property] IN ('Col1','Col1')"

但我需要看起来如下

Name|PropertyID|Col1|PropertyID|Col2

列PropertyID以

格式存储在table2中
ID|PropertyID|Col1|Col2

如何以上述格式显示?

0 个答案:

没有答案