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 |
|
yingchai
Starting Member
33 Posts |
Posted - 2011-06-07 : 02:44:22
|
| 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 tableyear period quarter--------------------------2011 01 Q12011 02 Q12011 03 Q1Based on the example above, I intend to get the following result set:year period quarter preyear--------------------------2011 01 Q1 20102011 02 Q1 20102011 03 Q1 2010Any help you can provide with be greatly appreciated. |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2011-06-07 : 03:40:35
|
select year, period, quarter, year - 1 as preyear from yourtablenamehere N 56°04'39.26"E 12°55'05.63" |
 |
|
|
yingchai
Starting Member
33 Posts |
Posted - 2011-06-07 : 03:59:15
|
| Thanks Peso! |
 |
|
|
|
|
|