Skip to main content
1 of 4

Select Multiple Values from Same Column; one sql statment and split into separate columns

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 ?