Sql 行轉列

1、未轉換前
在這裏插入圖片描述2、 行轉列函數:UNPIVOT()

SELECT * FROM (select std0, std1,std2,std3,std4,std5,std6,std9 from table t) 
UNPIVOT("value" FOR "name" IN(std0 as '哈哈1',std1 as '哈哈2',std2 as '哈哈3',std3 as '哈哈4',std4 as '哈哈5',std5 as '哈哈6',std6 as '哈哈7',std9 as '哈哈8'))

在這裏插入圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章