行转列 列转行 sql 脚本的编写
行转列 列转行 sql 脚本的编写
1. sql 脚本编写 行转列 列转行
表设计 test_table id varchar(11), name varchar(255), table_desc varchar(255) sql 编写
行转列
select concatenate("id",""), concatenate("name",""), concatenate("desc",""), concatenate( "" ,( select * from test_table a where 1=1 limit 1 desc ) ) from test_table b
列转行
select concatenate("id",""),* from test_table a union ( select b.id from test_table b limit 1 desc ) ; |
Java技术 文章被收录于专栏
JavaEE技术 编程开发经验 企业通用技术
查看8道真题和解析