Question : MySQL Rows to Columns by Group

Given the table below, how can I group all rows for a certain user and present them as columns in the query output?

If possible I would also like to know how efficient this procedure is given that there will only ever be one row in the query output.

Is there a better way to store user-specific fields?
Attachments:
 
Desired Input/Output
Desired Input/Output
 

Answer : MySQL Rows to Columns by Group

>Your second suggestion seems far more workable to me if using one field per record.
yes, but it has also it's limitation: the total size of the returned string shall not be too long ...

anyhow, I do prefer what you have implemented so far.
usually, though, I keep the "most common" properties in the normal table layout (1 column per value), and only "exceptional" settings are stored in this table ..
Random Solutions  
 
programming4us programming4us