oracle query week, this month, this year

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

 

Published 231 original articles · won praise 3 · Views 7994

Guess you like

Origin blog.csdn.net/qq_32265719/article/details/103859042