Home > Database > Mysql Tutorial > body text

03. 行列转换写法小结

WBOY
Release: 2016-06-07 17:42:31
Original
1155 people have browsed it

行列转换,通常有2种方法,一是CASE WHEN/UNION;一是PIVOT/UNPIVOT。对于行值或列数不固定的情况,需要用动态SQL。 一. 行转列 RowToCol(ID int ,Code varchar ( 10 ),Value int ) Go insert RowToCol ,,,,,,,,,,,,,RowToCol

行列转换,通常有2种方法,香港空间,美国空间,美国服务器,一是CASE WHEN/UNION;一是PIVOT/UNPIVOT。对于行值或列数不固定的情况,需要用动态SQL。


一. 行转列

RowToCol ( ID int, Code varchar(10), Value int ) Go insert RowToCol ,,,,,,,,,,,,,RowToCol

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!