declare @s varchar(8000)
set @s=''
select @s=@s+',utp.['+tablename+']=max(case utp.tablename when '''+utp.tablename+''' then utp.[power] else NULL end)'
from utp group by tablenameexec('select usertable.tname,utp.Uname'+@s+'
from utp
join usertable on utp.uname=usertable.uname
group by usertable.Uname')
set @s=''
select @s=@s+',utp.['+tablename+']=max(case utp.tablename when '''+utp.tablename+''' then utp.[power] else NULL end)'
from utp group by tablenameexec('select usertable.tname,utp.Uname'+@s+'
from utp
join usertable on utp.uname=usertable.uname
group by usertable.Uname')
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货