Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/74.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql Oracle查询显示从当前年度开始的前5年_Sql_Oracle11g - Fatal编程技术网

Sql Oracle查询显示从当前年度开始的前5年

Sql Oracle查询显示从当前年度开始的前5年,sql,oracle11g,Sql,Oracle11g,我想编写一个oracle查询,以显示从当前年份开始的前5年。 至于显示当前年份,我有以下内容: select CurrYear FROM ReportData where TO_DAte(CurrYear , 'mm/dd/yyyy') = SYSDATE curryear列是字符串还是日期 假设这是一个日期,以下是一些选项,以适应前5年的各种相关问题: where curryear >= add_months(trunc(sysdate ),5 * 12) wh

我想编写一个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')
其中curryyear>=添加月份(trunc(sysdate),5*12)
其中curryyear>=添加月份(trunc(sysdate,'YYYY'),5*12)
其中curryear>=添加月份(trunc(sysdate,'YYYY')、5*12)和
curryyear