|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
how to do calculation of dates?
HI,
getdate() gives me today's date. I have a sql query which returns me a date. I want to see if the difference between today's date and the date returned by sql query is 12 months(1 year) or less. If yes I want to print it. (If the difference is more than 12 months or 1 year i don't want to consider that record.) Example: how to do calculate: 10/05/2004-10/3/2003 |
|
#3
|
|||
|
|||
|
Code:
case when Datediff(mm, (select date from...), getdate()) <= 12 then .... else .... end Or it should be something like that |
|
#4
|
||||
|
||||
|
more like this:
Code:
select foo, bar, datecolumn from yourtable where datediff(m,datecolumn,getdate()) <= 12 |
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > how to do calculation of dates? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|