运行SQL查询以获取具有给定范围内的日期的数据。 stdt是日期数据类型。这是有问题的代码:
select hofc_wrk_unit_uid
from mhal_rep.stusha
where STDT BETWEEN date('2010-01-21') AND to_char(SYSDATE, 'YYYY-MM-DD')
and ibmsnap_operation not in ('D')
and stus_cd in ('CLSD')
我一直收到错误“列'SYSDATE'不存在”
如何让它调用SYSDATE函数并停止查找名为sysdate的列?
试过这个:
select hofc_wrk_unit_uid
from mhal_rep.stushh
where STDT BETWEEN date('2010-01-21') AND SYSDATE()
and stus_endt BETWEEN date('2010-01-21') AND SYSDATE()
and stus_cd in ('DWPC')
and ibmsnap_operation not in ('D')
并且我正在获取函数sysdate()不存在
请尝试以下方法:
select hofc_wrk_unit_uid
from mhal_rep.stushh
where STDT BETWEEN date('2010-01-21') AND current_date
and stus_endt BETWEEN date('2010-01-21') AND current_date
and stus_cd in ('DWPC')
and ibmsnap_operation not in ('D')