Transpose rows into columns in MySQL

后端 未结 1 765
别那么骄傲
别那么骄傲 2020-11-29 13:17

How can I convert rows into columns in a MySQL query?

相关标签:
1条回答
  • 2020-11-29 13:48

    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

    0 讨论(0)
提交回复
热议问题