表:stu_list
1 ,張三, 80, 90, 70
2 ,李四, 81, 91, 71
3 ,王五, 82, 92, 72
//2列轉換爲行顯示
-- unpivot:列轉行顯示
select 主鍵ID,姓名,科目,分數 from stu_list
unpivot (分數 for 科目 in (語文,數學,英語)) where 2>1
“分數”與" 科目" 爲自定義
//3行轉換列顯示
-- pivot:行轉列顯示
select * from stu_list pivot (max(語文) for 姓名 in ('張三'張三,‘李四’李四,'王五'王五))
"max(語文)=列顯示值字段“
"姓名=爲需要轉爲列頭的原列名"