mysql 行列动态转换(列联表,交叉表)
http://www.cnblogs.com/emanlee/p/3550149.html
create table table_name( id int primary key, col1 char(2), col2 char(2), col3 int);insert into table_name values(1 ,'A1','B1',9),(2 ,'A2','B1',7),(3 ,'A3','B1',4),(4 ,'A4','B1',2),(5 ,'A1','B2',2),(6 ,'A2','B2',9),(7 ,'A3','B2',8),(8 ,'A4','B2',5),(9 ,'A1','B3',1),(10 ,'A2','B3',8),(11 ,'A3','B3',8),(12 ,'A4','B3',6),(13 ,'A1','B4',8),(14 ,'A2','B4',2),(15 ,'A3','B4',6),(16 ,'A4','B4',9),(17 ,'A1','B4',3),......
阅读全文