这是我的写法,好象有点麻烦:
select birth_dte, birth_dte + 20 from worker_record
where to_char(birth_dte - 20, 'mmdd') < to_char(sysdate, 'mmdd')
and to_char(birth_dte, 'mmdd') > to_char(sysdate, 'mmdd');有没有更好的?
select birth_dte, birth_dte + 20 from worker_record
where to_char(birth_dte - 20, 'mmdd') < to_char(sysdate, 'mmdd')
and to_char(birth_dte, 'mmdd') > to_char(sysdate, 'mmdd');有没有更好的?
解决方案 »
- 写的一触发器在oracle11下好好的oracle10出问题
- (急急急急急急急急急急急急急急急急急)
- 请教一个关于求平均值得语句
- Oracle函数的例子,把例子运行一遍,你会学到点东西哈!快乐就好!我刚边学边写的。
- 一个PL/SQL块,本地动态SQL执行DDL语句:
- 关于基础SELECT 语句问题,求大大指正,谢啦~~
- 求两表合并统计的SQL语句?不知能否实现
- 惨,还是SQLLDR控制文件的问题--在线等待
- 有没有讲解用pl/sql建视图的文档啊?比较详细一点的就行,谢谢了,谁有就把分大部分给谁了。
- 各位大侠,谁知道? 能不能设置oracle数据库日期的默认格式,100分相送!!!!!
- 跪求ORACLE7.3和ORACLE 8i共存的方法
- oracle8i或9i哪有下载的?
select * from worker_record
where to_char(birth_dte - 20, 'mmdd') < to_char(sysdate, 'mmdd')
and to_char(birth_dte, 'mmdd') > to_char(sysdate, 'mmdd');
怎么比较?
birth_dte - 20 < sysdate??birth_dte的值比sysdate小很多,没法比较吧!
你写个语句看看。
select * from worker_record
where to_char(birth_dte - 20, 'mmdd') < to_char(sysdate, 'mmdd')
and to_char(birth_dte, 'mmdd') > to_char(sysdate, 'mmdd')
and to_char(birth_dte, 'yyyy') = to-char(sysdate, 'yyyy')
select * from worker_record
where to_char(birth_dte - 20, 'mmdd') < to_char(sysdate, 'mmdd')
and to_char(birth_dte, 'mmdd') > to_char(sysdate, 'mmdd')
and to_char(birth_dte, 'yyyy') = to-char(sysdate, 'yyyy')
select * from table where to_date('1970-01-01','yyyy-mm-dd')-20 = to_date(sysdate,'yyyy-mm-dd')