表a:
Name Channel score-----------------------Suresh Web 100Suresh App 50
Name Channel score
-----------------------
Suresh Web 100
Suresh App 50
表b:
Name Web App-----------------------Suresh 100 50
Name Web App
Suresh 100 50
我想知道SQL中的一种方法来做到这一点。我想转换列通道的类别值与相应的值与它相关联的分数。基本上就像一个变形
brqmpdu11#
select Name, App, Webfrom MyTable apivot (max(score) for channel in ([App],[Web])) p
select Name, App, Web
from MyTable a
pivot (max(score) for channel in ([App],[Web])) p
1条答案
按热度按时间brqmpdu11#