How can I add one month to a date that I am checking under the where clause?
e.g.:
select *
from Reference
where reference_dt + 1 month
How can I add one month to a date that I am checking under the where clause?
e.g.:
select *
from Reference
where reference_dt + 1 month
select * from Reference where reference_dt = DateAdd(month,1,another_date_reference)
Look at DATEADD
SELECT DATEADD(mm, 1, OrderDate)AS TimeFrame
Here's the MSDN
In your case
...WHERE reference_dt = DATEADD(MM,1, myColDate)
Use DATEADD
:
DATEADD(month, 1, reference_dt)
DateAdd(m,1,reference_dt)
will add a month to the column value
select * from Reference where reference_dt = DATEADD(mm, 1, reference_dt)
DATEADD
is the way to go with this
See the W3Schools tutorial: http://www.w3schools.com/sql/func_dateadd.asp