Transpose rows into columns in MySQL

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:

http://www.artfulsoftware.com/infotree/queries.php#78

Leave a Comment