June 7, 2011 at 12:43 am
Hi, I need your expertise on this issue. Basically the reason to do this is to calculate YTD values.
For example, I have the following period table
year period quarter
--------------------------
2011 01 Q1
2011 02 Q1
2011 03 Q1
Based on the example above, I intend to get the following result set:
year period quarter preyear
--------------------------
2011 01 Q1 2010
2011 02 Q1 2010
2011 03 Q1 2010
Any help you can provide with be greatly appreciated.
June 7, 2011 at 2:14 am
Just add the following in the select list
(YEAR - 1) AS PreYear
June 7, 2011 at 3:05 am
In case you require it in the table structure, you can go for computed columns... more details from MSDN
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply