declare @sql varchar(8000) set @sql='' select @sql=@sql+',sum(case when 功能名'''+功能名+''' then ''true'' else ''false'' end) as 功能'+功能id+' from [function] group by 功能名exec('select 模块'+@sql+' from [function] group by 模块名') --没调试
declare @sql varchar(8000) set @sql='' select @sql=@sql+',max(case when 功能名='''+功能名+''' then ''true'' else ''false'' end) as 功能'+cast(max(功能id) as char(2))+ ',max(case when 功能ID='+cast(max(功能id) as char(2))+' then 功能名 end) as 功能名 ' from [function] group by 功能名 order by max(功能id)exec('select 模块'+@sql+' from [function] group by 模块')
declare @sql varchar(8000) set @sql='' select @sql=@sql+',max(case when 功能名='''+功能名+''' then ''true'' else ''false'' end) as 功能'+cast(max(功能id) as char(2)) +','''+功能名+''''+'as 功能名'from [function] group by 功能名 order by max(功能id)exec('select 模块'+@sql+' from [function] group by 模块')
set @sql=''
select @sql=@sql+',sum(case when 功能名'''+功能名+''' then ''true'' else ''false'' end) as 功能'+功能id+'
from [function]
group by 功能名exec('select 模块'+@sql+' from [function] group by 模块名')
--没调试
set @sql=''
select @sql=@sql+',max(case when 功能名='''+功能名+''' then ''true'' else ''false'' end) as 功能'+cast(max(功能id) as char(2))+
',max(case when 功能ID='+cast(max(功能id) as char(2))+' then 功能名 end) as 功能名 '
from [function]
group by 功能名 order by max(功能id)exec('select 模块'+@sql+' from [function] group by 模块')
set @sql=''
select @sql=@sql+',max(case when 功能名='''+功能名+''' then ''true'' else ''false'' end) as 功能'+cast(max(功能id) as char(2))
+','''+功能名+''''+'as 功能名'from [function]
group by 功能名 order by max(功能id)exec('select 模块'+@sql+' from [function] group by 模块')