我在语法查询dbms oracle中很难按日期进行过滤,但是我只想按日期(dd / mm)进行过滤。而我的数据数据库记录是(dd / mm / yyyy)。如何查询按日期mm / dd过滤
tablename.fieldname> = '01 / 01'
答案 0 :(得分:2)
with s as (
select date '2019-01-01' + level * 15 dt from dual connect by level <= 20)
select s.*
from s
where to_number(to_char(dt, 'mmdd')) > 0501;
DT
-------------------
2019-05-16 00:00:00
2019-05-31 00:00:00
2019-06-15 00:00:00
2019-06-30 00:00:00
2019-07-15 00:00:00
2019-07-30 00:00:00
2019-08-14 00:00:00
2019-08-29 00:00:00
2019-09-13 00:00:00
2019-09-28 00:00:00
2019-10-13 00:00:00
2019-10-28 00:00:00
12 rows selected.
答案 1 :(得分:1)
您尝试过类似的方法吗?虽然这不是您想要的格式
SELECT * from yourTableName
WHERE EXTRACT(month from yourDateColumn) >= '1'
AND EXTRACT(day from yourDateColumn) >= '1';
可能的相关问题: