这个问题能用PIVOT解决吗?
Id | Type | Name | Value
-------------+-------+--------------+-------------
F0000000FG | FD | SEDOL | 4779823
F0000000FG | FD | ExternalId | 6789
->
Id | Type | SEDOL | ExternalId
-------------+-------+----------+-------------
F0000000FG | FD | 4779823 | 6789
------解决方案----------------------确定列数为以上4列时
select
*
from
T
pviot
(max([value] for Name in([SEDOL],[ExternalId])))tmp
------大于4列时
select
*
from
(select
ID,type,Name, [values]
from
T )T2
pviot
(max([value] for Name in([SEDOL],[ExternalId])))tmp