文件名称:数据库行专列技术(SQL)
文件大小:2KB
文件格式:SQL
更新时间:2013-06-11 02:14:42
数据库行专列技术
declare @s nvarchar(1000) select @s = 'select [name] as 姓名' select @s = @s + ',sum(case when subject=''' + cast(subject as varchar) + ''' then result end) as ' + subject from CJ group by subject select @s = @s + ' from CJ group by [name]'