DECLARE @sql VARCHAR(8000)SET @sql = ''SELECT @sql = ISNULL(@sql + ',', '') + QUOTENAME([dates]) + '=max(case when [dates]=' + QUOTENAME([dates], '''') + ' then [subtotal] else 0 end)'FROM [V_ALL_Performance]GROUP BY [dates]--PRint @sqlEXEC('select [thisuser]'+@sql+' from [V_ALL_Performance] group by [thisuser]')
新闻热点
疑难解答