text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 select Name, sum(LQProjectedRevenue) as LQProjectedRevenue, SUM(TQProjectedRevenue) as TQProjectedRevenue, SUM(NQProjectedRevenue) as NQProjectedRevenue, SUM(LQCostSavings) as LQCostSavings, SUM(TQCostSavings) as TQCostSavings, SUM(NQCostSavings) as NQCostSavings, SUM(LQBUDirectCosts) as LQBUDirectCosts, SUM(TQBUDirectCosts) as TQBUDirectCosts, SUM(NQBUDirectCosts) as NQBUDirectCosts, MAX(LQ) as LQ, MAX(TQ) as TQ, MAX(NQ) as NQ from ( select t.Name, (select s.ProjectedRevenue from FiscalCalendar lfc where DATEADD(month, -3, GETDATE())<dateadd(day, 1, lfc.EndDate) and DATEADD(month, -3, GETDATE())>dateadd(day, 1, lfc.StartDate) and lfc.Name like '%[Q]%' and s.EndDate > lfc.StartDate and s.EndDate < lfc.EndDate) as LQProjectedRevenue, (select s.ProjectedRevenue from FiscalCalendar tfc where DATEADD(month, 0, GETDATE())<dateadd(day, 1, tfc.EndDate) and DATEADD(month, 0, GETDATE())>dateadd(day, 1, tfc.StartDate) and tfc.Name like '%[Q]%' and s.EndDate > tfc.StartDate and s.EndDate < tfc.EndDate) as TQProjectedRevenue, (select s.ProjectedRevenue from FiscalCalendar nfc where DATEADD(month, 3, GETDATE())<dateadd(day, 1, nfc.EndDate) and DATEADD(month, 3, GETDATE())>dateadd(day, 1, nfc.StartDate) and nfc.Name like '%[Q]%' and s.EndDate > nfc.StartDate and s.EndDate < nfc.EndDate) as NQProjectedRevenue, (select s.CostSavings from FiscalCalendar lfc where DATEADD(month, -3, GETDATE())<dateadd(day, 1, lfc.EndDate) and DATEADD(month, -3, GETDATE())>dateadd(day, 1, lfc.StartDate) and lfc.Name like '%[Q]%' and s.EndDate > lfc.StartDate and s.EndDate < lfc.EndDate) as LQCostSavings, (select s.CostSavings from FiscalCalendar tfc where DATEADD(month, 0, GETDATE())<dateadd(day, 1, tfc.EndDate) and DATEADD(month, 0, GETDATE())>dateadd(day, 1, tfc.StartDate) and tfc.Name like '%[Q]%' and s.EndDate > tfc.StartDate and s.EndDate < tfc.EndDate) as TQCostSavings, (select s.CostSavings from FiscalCalendar nfc where DATEADD(month, 3, GETDATE())<dateadd(day, 1, nfc.EndDate) and DATEADD(month, 3, GETDATE())>dateadd(day, 1, nfc.StartDate) and nfc.Name like '%[Q]%' and s.EndDate > nfc.StartDate and s.EndDate < nfc.EndDate) as NQCostSavings, (select s.BUDirectCosts from FiscalCalendar lfc where DATEADD(month, -3, GETDATE())<dateadd(day, 1, lfc.EndDate) and DATEADD(month, -3, GETDATE())>dateadd(day, 1, lfc.StartDate) and lfc.Name like '%[Q]%' and s.EndDate > lfc.StartDate and s.EndDate < lfc.EndDate) as LQBUDirectCosts, (select s.BUDirectCosts from FiscalCalendar tfc where DATEADD(month, 0, GETDATE())<dateadd(day, 1, tfc.EndDate) and DATEADD(month, 0, GETDATE())>dateadd(day, 1, tfc.StartDate) and tfc.Name like '%[Q]%' and s.EndDate > tfc.StartDate and s.EndDate < tfc.EndDate) as TQBUDirectCosts, (select s.BUDirectCosts from FiscalCalendar nfc where DATEADD(month, 3, GETDATE())<dateadd(day, 1, nfc.EndDate) and DATEADD(month, 3, GETDATE())>dateadd(day, 1, nfc.StartDate) and nfc.Name like '%[Q]%' and s.EndDate > nfc.StartDate and s.EndDate < nfc.EndDate) as NQBUDirectCosts, (select lfc.Name+' '+convert(char, lfc.YearInt) From FiscalCalendar lfc where DATEADD(month, -3, GETDATE())<dateadd(day, 1, lfc.EndDate) and DATEADD(month, -3, GETDATE())>dateadd(day, 1, lfc.StartDate) and lfc.Name like '%[Q]%') as LQ, (select tfc.Name+' '+convert(char, tfc.YearInt) From FiscalCalendar tfc where DATEADD(month, 0, GETDATE())<dateadd(day, 1, tfc.EndDate) and DATEADD(month, 0, GETDATE())>dateadd(day, 1, tfc.StartDate) and tfc.Name like '%[Q]%') as TQ, (select nfc.Name+' '+convert(char, nfc.YearInt) From FiscalCalendar nfc where DATEADD(month, 3, GETDATE())<dateadd(day, 1, nfc.EndDate) and DATEADD(month, 3, GETDATE())>dateadd(day, 1, nfc.StartDate) and nfc.Name like '%[Q]%') as NQ from Project p, Scenario s, Team t, Team2Project tp, Status st where t.Id = tp.TeamId and p.Id = tp.ProjectId and s.ParentId = p.Id and st.Id = p.StatusId and p.IsRevenueGenerating=1 and s.Status=1) as z group by Name