问题
I have one date column MyDate and I want those records in which MyDate should be less than current date by 2 years.
回答1:
For DB2 you can use this
MYDATECOLUMN < CURRENT DATE - 2 YEAR
回答2:
if DB Server = MS SQL , then try :-
select *
from myTable
where MyDate < dateadd(year, -2, getdate())
来源:https://stackoverflow.com/questions/19582599/sql-query-where-mydate-should-be-less-than-2-years-from-the-current-date