I need to 'convert' my table headers to columns and 'join' the attributing value. This is more a formatting issue than say a pivot table issue as I do not need to add up or combine multiple values and i will only ever have 1 result returned.
I run a query to get the particular record i need.
SELECT * FROM member WHERE id = 1;
RESULT:
id | name | height | hair colour | eye colour
---------------------------------------------
1 | john | 6ft | black | blue
The result that i would like to be able to have straight away out of the query is:
Feature | Description
-------------------------
name | john
height | 6ft
hair colour | black
eye colour | blue
So I could be wrong in saying its 'just' a formatting issue but reading through various posts on Pivot tables etc, has made me more confused over how to go about something like this.
Any solutions to this would be much appreciated.
Thanks in advance guys.
Answer:
After unconfusing myself with pivoting - i just did mini select statements for each column and value and UNION them together.
select 'Feature', 'Description'
union all
select 'Name:' , name from member where id = 1
union all
select 'Height:', height from member where id = 1
union all
select 'Hair Colour:', hair_colour from member where id = 1
union all
select 'Eye Colour:', eye_colour from member where id = 1