Home >Database >Mysql Tutorial >10 recommended articles about changing columns to rows

10 recommended articles about changing columns to rows

黄舟
黄舟Original
2017-06-14 16:27:581089browse

One day, a netizen in a circle on QQ sent a message asking for help: PropID name Amount3 Yuanbao 22 Le Dou 3 can be written as an output in a sql, which is to copy the number of entries corresponding to Amount: PropID name3 Yuanbao 3 Yuanbao 2 Le Bean 2 Le Dou 2 Le Dou [Note]: 3 Yuanbao 2 Note that the last column is 2, which means there are 2 such records

1. MySQL uses numeric auxiliary tables to implement complex Column changes to row

10 recommended articles about changing columns to rows

Introduction: After some research, use ordinary group by sum if case when and so on I couldn't figure it out, so I had to change my mind. I was stuck for a while, so I talked to the netizen Mr.W, and he provided the idea of ​​​​a digital auxiliary table.

2. MySQL uses numeric auxiliary tables to implement complex column changes_MySQL

10 recommended articles about changing columns to rows

##Introduction: MySQL uses numeric auxiliary tables to implement complex column changes and row changes

3. [MySQL] Row and row conversion changes can be implemented in various ways Summary (row change column report statistics, column change row data record statistics, etc.)_MySQL

Introduction: Preface: Mysql row changes, the most difficult thing is to change multiple columns into Multi-row, the most commonly used method is to change rows to columns and columns to rows in statistics. I couldn't find any ready-made functions or statements, so I wrote a stored procedure myself and used dynamic SQL to implement it. In the application business scenario, users have it every month. make


The above is the detailed content of 10 recommended articles about changing columns to rows. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn