--查询本周周一到当天的数据
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 发布
本文介绍如何使用SQL查询特定时间段的数据,包括本周、本月和本年数据的筛选方法。通过具体的SQL语句示例,读者可以学习如何根据日期范围进行数据筛选。
823

被折叠的 条评论
为什么被折叠?



