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.
可能这个问题是愚蠢的或重复的,但我没有得到确切的答案
我有具有日期格式列(eff_date)的表,我想要 sysdate 和 eff_date 之间的差异超过两年且等于两年的数据
我正在使用这个查询我知道它的语法错误
select * from Customer where (select floor(months_between(sysdate,eff_date)/12) from Customer t) >= 2
如果你想使用months_between
months_between
SELECT * FROM customer WHERE months_between( sysdate, eff_date ) >= 24
但是,如果有一个索引eff_date,您可能想要
eff_date
SELECT * FROM customer WHERE eff_date <= sysdate - interval '2' year