0

How do I convert this:

Name    Attributes
----    ----------
John    Height
John    Weight
John    Age
Mary    Shoe Size
Mary    Hair Color
Mary    Eye Color

to this:    

Height  Weight  Age

Name and Attributes are two fields in an Access table. I want to convert the Attribute values into fields names based on the value in the Name field. I am using MS Access 2010.

I presume I do something to the effect of select ??? from table where name="John"

1 Answer 1

0

Add a 'Value' field to your table so it will read like this:

Name  Attributes  Value
----  ----------  -----
John  Height      172
John  Weight      87
John  Age         25
Mary  Shoe Size   9.5
Mary  Hair Color  Brown
Mary  Eye Color   Blue

You can use 'TRANSFORM' and 'PIVOT' in Access

TRANSFORM FIRST(Value)
SELECT Name FROM MyTable
GROUP BY Name
PIVOT Attributes

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.