--查询本周周一到当天的数据
select * from table where time> sysdate - (to_char(sysdate,'D')-1)
--取本周时间内的数据
select * from table where time>=trunc(next_day(sysdate-8,1)+1) and time<=trunc(next_day(sysdate-8,1)+7)+1 ;
--国外的
select * from table where time>=trunc(next_day(sysdate-8,1)) and time<=trunc(next_day(sysdate-8,1)+7);
--本月的
select * from table where time>=TRUNC(SYSDATE, 'MM') and time<=last_day(SYSDATE);
--本年的
select * from table where to_char(time,'yyyy')=to_char(sysdate,'yyyy');
oracle SQL 语句取周一到当前、本周、本月、本年的数据
最新推荐文章于 2024-04-29 10:32:00 发布