SqlServer:遊標+Case 實現行列轉化

需要轉化的表結構/以及數據: 使用SQl中的Pivot實現 select b.Name,sum(b.地理) 地理,sum(b.英語) 英語,sum(b.語文) 語文,sum(b.數學) 數學 from MCS_TEST.dbo.UserScore a pivot(sum(Score) for [Subject] in(數學,語文,英語,地理)) b group by b.Name 使用 遊標+C
相關文章
相關標籤/搜索