oracle 中查询本年、本月、 本周的数据

     --本周

select * from 表 where time > sysdate - (to_char(sysdate-1,'D'))
--本月
select * from 表 where time>=TRUNC(SYSDATE, 'MM') and time<=last_day(SYSDATE)
--本年
select * from 表 where to_char(time,'yyyy')=to_char(sysdate,'yyyy')



猜你喜欢

转载自blog.csdn.net/qq_38384994/article/details/78416751