Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.
SELECT v.rep, Sum(v.[Gross Rev]) as GrossRev, DATENAME(month, v.Funded) as Mth , month(v.Funded) as MthI Into #temp FROM CRMPROD_01.dbo.v_P_Reporting v WHERE v.Funded is not null and v.Status <> 'Closed' and (YEAR(v.Funded) = YEAR(getdate())) and (MONTH(v.Funded) > MONTH(getdate())-@) Group by rep, v.Funded ORDER BY v.rep, month(v.Funded) --Create Dynamic SQl and Pivot declare @sql varchar(4000) declare @columns varchar(8000) select @columns = coalesce(@columns+',','') + '[' + Mth + ']' from #temp group by Mth, MthI order by MthI set @sql = ' SELECT [rep], ' + @columns + ' FROM (SELECT [rep], [GrossRev], [Mth] as Mth from #temp) src PIVOT (Sum ([GrossRev]) FOR Mth IN (' + @columns + ') ) AS pvt' EXEC (@sql) Drop table #temp
|C# SQL BULK INSERT CLASS||5||33|
|Extract XML Data from using TSQL||5||27|
|Help with highlighting rows based on identical values in multiple columns||1||24|
|help with issues with ReportViewer in VS2015||5||22|
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
12 Experts available now in Live!