I'm pivoting data which contains name and phone numbers for some person records. The row which I'm pivoting contains questions which are: name, phone, name, phone. Yes, the questions are the same repeated text.
My pivot function is like so
SELECT pesonnel_id, Qasked, Qanswered FROM .... pivot (max(QAnswered) for QAsked in ([Name], [Phone], [Name], [Phone])) p
Obviously, SQL does not like that ....it says [Name] was specified multiple times for p....hmmm, how do I get around this?
I do have a set number of the questions, it is just these 4 (name, phone, name, phone), so I don't mind 'hardcoding' something in, just don't know how/where. I'm using SQL2012.
Thanks for your advice.