Oracle 时间筛选
来源:百度知道 编辑:UC知道 时间:2024/05/23 16:37:20
select to_char(edit_time) as newtime from table where newtime in (select to_char(sysdate-1.'dd') from dual)
*
ERROR 位于第 1 行:
ORA-00906: 缺少左括号
in 前面是从库里面提取的时间字段
in 后面是系统生成的当前时间
都可以独立运行
可是和到一起就不可以了
是不是我的in用的不对,应该用什么进行筛选?
赐教
select to_char(edit_time,'dd') as newtime from table where newtime in (select to_char(sysdate-1.'dd') from dual);
*
ERROR 位于第 1 行:
ORA-00906: 缺少左括号
in 前面是从库里面提取的时间字段
in 后面是系统生成的当前时间
都可以独立运行
可是和到一起就不可以了
是不是我的in用的不对,应该用什么进行筛选?
赐教
select to_char(edit_time,'dd') as newtime from table where newtime in (select to_char(sysdate-1.'dd') from dual);
select to_char(sysdate-1.'dd') from dual);
1后边是逗号,
看你的语句是取一个日期,干嘛要用IN呢,IN很影响执行效率,特别是表中数据比较大的时候,我觉得用这个就可以:
select to_char(edit_time,'dd') as newtime from table where newtime=to_char(sysdate-1,'dd')