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.
我想编写一个 oracle 查询来显示从当前年份开始的前 5 年。至于显示当前年份,我有这个:
select CurrYear FROM ReportData where TO_DAte(CurrYear , 'mm/dd/yyyy') = SYSDATE
curryear 列是字符串还是日期?
假设这是一个日期,这里有一些选项可以适应各种过去 5 年的相关问题:
where curryear >= add_months(trunc(sysdate ),5 * 12) where curryear >= add_months(trunc(sysdate,'YYYY'),5 * 12) where curryear >= add_months(trunc(sysdate,'YYYY'),5 * 12) and curryear < trunc(sysdate,'YYYY')