Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
lebz
Starting Member
7 Posts |
Posted - 2011-07-11 : 09:54:08
|
Hi,How do i create an indefitite period number? I have created a quesry below that brings up wbs1,wbs2,wbs3,period numner and pr umber up to period 24 but i want the query to bring more periods with having to write more "period numbers"?here is the query:SELECT pr.PRNumber, w1.Code as 'WBS Code1', w2.Code as 'WBS Code2', w3.Code 'WBS Code3', (Case When pp.periodnumber = 1 Then Sum(a.value*c.Ratio/100) else 0 end) as 'Period1', (Case When pp.periodnumber = 2 Then Sum(a.value*c.Ratio/100) else 0 end) as 'Period2', (Case When pp.periodnumber = 3 Then Sum(a.value*c.Ratio/100) else 0 end) as 'Period3', (Case When pp.periodnumber = 4 Then Sum(a.value*c.Ratio/100) else 0 end) as 'Period4', (Case When pp.periodnumber = 5 Then Sum(a.value*c.Ratio/100) else 0 end) as 'Period5', (Case When pp.periodnumber = 6 Then Sum(a.value*c.Ratio/100) else 0 end) as 'Period6',tshepo |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|
|
|