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 |
|
pumza.magona
Starting Member
6 Posts |
Posted - 2010-08-11 : 10:07:41
|
| I need your help guyz, dont know what to do here.Issue is:How do a caculate monthly growth in one table. I have a table that has data from 2007 till to date and would like to calculate the monthly growth using the base column. The following syntax gives me the growth for July 2010, but then I want to be dynamic so I dont need to put statements (where MonthYear = 'June 2010').(select ((select basefrom subSubscriberBaseOverviewwhere MonthYear = 'July 2010'and SubscriberState = 'active')-((select basefrom subSubscriberBaseOverviewwhere MonthYear = 'June 2010'and SubscriberState = 'active')))/(select basefrom subSubscriberBaseOverviewwhere MonthYear = 'June 2010'and SubscriberState = 'active'))where subSubscriberBaseOverview.subscriberstate = 'active'and subSubscriberBaseOverview.monthyear = 'July 2010'Your assistance will be highly appreciated.Pushy |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-08-11 : 10:47:58
|
| why are storing the Month Year values in this format? Also do you have a calendar table where you can lookup these values against and get sequential Period_ID or something which allows you to traverse sequentially backwards?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|