Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails
declare @sql as varchar(max) set @sql = 'insert into #TempReport select [Country],' + @cols + ' from ( select C.Country_Name AS [Country], D.GSL_Name AS [GSL], SUM(A.Allocation) AS Total from Work_Information A inner join Sales B on A.Sales_ID = B.Sales_Id inner join Countries C on A.Country_ID = C.Country_ID inner join tbl_GSL D on A.GSL_ID = D.GSL_ID AND A.Sales_ID = D.Sales_Id where A.Sales_Id = 1 group by A.Country_ID,C.Country_Name, A.Sales_ID, A.GSL_ID,D.GSL_Name ) P Pivot (sum(Total) for [GSL] in (' + @Cols + ')) as Pvt' exec(@sql) declare @SumCols as varchar(max) select @SumCols = stuff( (select ', Sum(' + quotename(GSLName) + ')' + REPLACE(GSLName,' ','') from ( select TOP 200 GSL_Name as GSLName from tbl_GSL GSL where Sales_Id = 1 ORDER BY GSL_Name ) GlobalSales ORDER BY GSLName FOR XML PATH('') ),1,2,'') declare @sql3 as varchar(1000) set @sql3 = 'select Country,' + @SumCols + ' from #TempReport group by Country WITH ROLLUP' exec(@sql3)
|SQL 2012: AG: drop database on secondary error: "ALTER DATABASE is not permitted while a database is in the Restoring state."||4||20|
|Need an intro to -- .Net SQL Authorization Manager||7||49|
|Sharepoint 2010 Product Configuration Wizard fails||4||23|
|Help with stripping out character in SQL LEFT/RIGHT/REPLACE||2||17|
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
18 Experts available now in Live!