日期:2014-05-18 浏览次数:20595 次
declare @sql nvarchar(1000) set @sql='select examineeId,examineeName,' select @sql=@sql+'sum(case appraisalName when '''+appraisalName+''' then result else 0 end) as '+appraisalName+',' from (select distinct appraisalName from finalresult) t set @sql=LEFT(@sql,len(@sql)-1)+' from finalresult group by examineeId,examineeName' exec(@sql)