I have looked into pivot but I think it requires an aggregate function which I do not need (I think).
The result of my query is this
Name Property Name PropertyValue
---------- ---------- ----------
lorem Work Phone 000.111.2020
ipsum Email test@email.com
To
Name Work Phone Email
---------- ---------- ----------
lorem 000.111.2020 test2@email.com
ipsum 001.101.2010 test3@email.com
I don’t think I should use pivot here because I don’t need to aggregate anything, I just want the row data to become a column.
PIVOT requires an aggregate, and yes, you would need an aggregate if your data was:
Given that you know your data is unique, you can just use MIN or MAX in your pivot.
NB: Your example output doesn’t match your exmaple input.
http://cloudexchange.cloudapp.net/stackoverflow/q/2589