1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25:
SELECT Project, [pjt_entity]+'-' AS Task, Sum (case when [acct]='directlabor'then [units] ELSE 0 END) AS ZinHrs, Sum(case when ([ACCT]='SUBCONTRACT' or [ACCT]='HEI' or [ACCT]='NGTS' or [acct]='ANALEX') then [UNITS] ELSE 0 End) AS SubHrs, Sum(case when([acct]='direct`labor') then [amount] Else 0 End) AS Labor, Sum(case when([ACCT]='SUBCONTRACT' Or [ACCT]='HEI' Or [ACCT]='NGTS' Or [acct]='ANALEX') then [AMOUNT] ELSE 0 End) AS Sub, Sum(case when[ACCT]='EQUIPMENT' then [AMOUNT] ELSE 0 End) AS Equipment, Sum(case when[acct]='fabrication' then [amount] ELSE 0 End) AS Fabrication, Sum(case when[acct]='material' then [amount] ELSE 0 End) AS Material, Sum(case when([acct]='misc odcs' Or [acct]='EDUC/TRAIN' Or [ACCT]='SUPPLIES') then [amount] else 0 end) AS MiscODC, Sum(case when[ACCT]='TRAVEL' then [AMOUNT] ELSE 0 End) AS Travel, Sum(case when([acct] Like 'alloc%' And [acct]<>'ALLOCFEE') then [AMOUNT] else 0 end) AS Indirect, Sum(case when[ACCT]='ALLOCFEE'then [AMOUNT] else 0 end) AS Fee, Sum(amount) AS TotalCost FROM [MyDatabase].dbo.[MyTable] WHERE ((fiscalno >= '200812' and (fiscalno)<=@fiscalno) AND ((acct)<>'BTD')) GROUP BY project, [pjt_entity]+'-' HAVING ((@proj = 'space102')) ORDER BY project, [pjt_entity]+'-';
SELECT Project, [pjt_entity]+'-' AS Task, Sum (case when [acct]='directlabor'then [units] ELSE 0 END) AS ZinHrs, Sum(case when ([ACCT]='SUBCONTRACT' or [ACCT]='HEI' or [ACCT]='NGTS' or [acct]='ANALEX') then [UNITS] ELSE 0 End) AS SubHrs, Sum(case when([acct]='directlabor') then [amount] Else 0 End) AS Labor, Sum(case when([ACCT]='SUBCONTRACT' Or [ACCT]='HEI' Or [ACCT]='NGTS' Or [acct]='ANALEX') then [AMOUNT] ELSE 0 End) AS Sub, Sum(case when[ACCT]='EQUIPMENT' then [AMOUNT] ELSE 0 End) AS Equipment, Sum(case when[acct]='fabrication' then [amount] ELSE 0 End) AS Fabrication, Sum(case when[acct]='material' then [amount] ELSE 0 End) AS Material, Sum(case when([acct]='misc odcs' Or [acct]='EDUC/TRAIN' Or [ACCT]='SUPPLIES') then [amount] else 0 end) AS MiscODC, Sum(case when[ACCT]='TRAVEL' then [AMOUNT] ELSE 0 End) AS Travel, Sum(case when([acct] Like 'alloc%' And [acct]<>'ALLOCFEE') then [AMOUNT] else 0 end) AS Indirect, Sum(case when[ACCT]='ALLOCFEE'then [AMOUNT] else 0 end) AS Fee, Sum(amount) AS TotalCost FROM [MyDatabase].dbo.[MyTable] WHERE ((fiscalno >= '201001' and (fiscalno)<=@fiscalno) AND ((acct)<>'BTD')) GROUP BY project, [pjt_entity]+'-' HAVING ((@proj = 'space101')) ORDER BY project, [pjt_entity]+'-';
SELECT Project, [pjt_entity]+'-' AS Task, Sum (case when [acct]='directlabor'then [units] ELSE 0 END) AS ZinHrs, Sum(case when ([ACCT]='SUBCONTRACT' or [ACCT]='HEI' or [ACCT]='NGTS' or [acct]='ANALEX') then [UNITS] ELSE 0 End) AS SubHrs, Sum(case when([acct]='directlabor') then [amount] Else 0 End) AS Labor, Sum(case when([ACCT]='SUBCONTRACT' Or [ACCT]='HEI' Or [ACCT]='NGTS' Or [acct]='ANALEX') then [AMOUNT] ELSE 0 End) AS Sub, Sum(case when[ACCT]='EQUIPMENT' then [AMOUNT] ELSE 0 End) AS Equipment, Sum(case when[acct]='fabrication' then [amount] ELSE 0 End) AS Fabrication, Sum(case when[acct]='material' then [amount] ELSE 0 End) AS Material, Sum(case when([acct]='misc odcs' Or [acct]='EDUC/TRAIN' Or [ACCT]='SUPPLIES') then [amount] else 0 end) AS MiscODC, Sum(case when[ACCT]='TRAVEL' then [AMOUNT] ELSE 0 End) AS Travel, Sum(case when([acct] Like 'alloc%' And [acct]<>'ALLOCFEE') then [AMOUNT] else 0 end) AS Indirect, Sum(case when[ACCT]='ALLOCFEE'then [AMOUNT] else 0 end) AS Fee, Sum(amount) AS TotalCost FROM [MyDatabase].dbo.[MyTable] WHERE ((fiscalno >= '201001' and (fiscalno)<=@fiscalno) AND ((acct)<>'BTD')) GROUP BY project, [pjt_entity]+'-' HAVING ((@proj = 'space106')) ORDER BY project, [pjt_entity]+'-';