ACCESS语句在sql server怎么用啊!
TRANSFORM Count(ccc.num)
SELECT ccc.name,address, Count(ccc.num) AS 合计
FROM ccc
GROUP BY ccc.name,address
PIVOT ccc.class;
这里面好像 TRANSFORM,PIVOT,sql都不认,是不是有其他语句可以替代?
谢谢!
[解决办法]
declare @sql varchar(8000)
set @sql = 'select name, sum(source) as 总分 '
select @sql = @sql + 'sum(case subject when ' '+subject+ ' '
then source else 0 end) as ' '+subject+ ' ', '
from (select distinct subject from test) as a
select @sql = left(@sql,len(@sql)-1) + ' from test group by name '
exec(@sql)