日期:2014-05-17 浏览次数:20528 次
declare @sql nvarchar(max) select @sql=isnull(@sql,'')+',max(case when bj='''+bj+''' then cj else 0 end)[班级'+bj+']' from(select distinct bj from tb)t exec('select jd=''季度''+rtrim(jd)'+@sql+' from tb group by jd')