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 |
|
AJCherniak
Starting Member
7 Posts |
Posted - 2009-04-03 : 15:23:08
|
| I need to add a field that shows the relative month to the current month. For example, it is now April, so for orders that delivered this month, I want the value to return as "0". If the order was delovered in March, I want it to return the value of "1" (as in one month ago) and so on. If the order was delivered in March of 2008, I want it to return the value of "13" (as in 13 months ago). Your help is much appriciated. |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2009-04-03 : 15:31:18
|
| look at DATEDIFF in books online.select datediff(month, orderDate, getdate())Be One with the OptimizerTG |
 |
|
|
AJCherniak
Starting Member
7 Posts |
Posted - 2009-04-03 : 16:01:25
|
| Wow. That was super easy. Thanks. |
 |
|
|
|
|
|