Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个日期列MyDate,我想要那些MyDate应该比当前日期少 2 年的记录。
MyDate
对于 DB2,您可以使用它
MYDATECOLUMN < CURRENT DATE - 2 YEAR
如果 DB Server = MS SQL ,则尝试:-
select * from myTable where MyDate < dateadd(year, -2, getdate())