问题
How can I get second table from first table using TRANSFORM and PIVOT functions:
TABLE_01
Config_ID | ConfigField | ConfigValue
-----------------------------------------
11 | Name | Basic
11 | Version | 1.01
11 | Owner | Jack
12 | Name | Advanced
12 | Version | 1.03
12 | Owner | Andy
TABLE_02
Config_ID | Name | Version | Owner
--------------------------------------------
11 | Basic | 1.01 | Jack
12 | Advanced | 1.03 | Andy
I'm trying this:
TRANSFORM ConfigValue
SELECT Config_ID
FROM TABLE_01
GROUP BY Config_ID
PIVOT ConfigField
but got an error:
"Your query does not include the specified expression 'ACValue' as part of aggregate function."
Help me, please!
Thank you!
回答1:
It looks like you are missing the aggregate function in the TRANSFORM:
TRANSFORM Max(ConfigValue)
SELECT Config_ID
FROM TABLE_01
GROUP BY Config_ID
PIVOT ConfigField
回答2:
I have found solution by myself:
TRANSFORM FIRST(ConfigValue)
SELECT Config_ID
FROM TABLE_01
GROUP BY Config_ID
PIVOT ConfigField
Thanks everyone for help.
来源:https://stackoverflow.com/questions/16691853/transform-and-pivot-in-access-2013-sql