How can I convert rows into columns in a MySQL query?
1 Answer
You can turn rows into a column with GROUP_CONCAT, but you can't transpose whole result sets in any automatic way. You either write a query that produces each column manually, or you do it in an application.
Here's a tutorial on writing the complicated queries to emulate the transposition:
PIVOTtechnique. In MySQL there is no inbuilt support so you need to useCASEstatements. Can you provide a small example of source data and desired results?