运行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()不存在
答案 0 :(得分:0)
尝试以下操作:
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')