This post derives from following –
Select Multiple Values from Same Column; one sql statment
Based on this query –
SELECT user_id,GROUP_CONCAT(meta_value ORDER BY id)
FROM t
WHERE meta_key IN('first_name','last_name','street_add','city','state')
GROUP BY user_id
It will give me a comma separated column, which is great and gives me the data, but is there a way to separate the fields into columns?
Best Answer
The way you are describing the expected result; I am concerned that what you are looking for won't get you what you want. Taking the example from the referenced post, you may actually want:
source