当月数据
Sql代码 复制代码
  1. select * from table t    
  2. where t.create_time >=TRUNC(SYSDATE, 'MM')    
  3. and t.create_time<=last_day(SYSDATE)  

当年数据
Sql代码 复制代码
  1. select * from table t   
  2. where t.create_time >=trunc(sysdate,'YYYY')    
  3. and t.create_time<=add_months(trunc(sysdate,'YYYY'),12)-1  

本周(国外周日为一个星期第一天)
Sql代码 复制代码
  1. where t.create_time >=trunc(sysdate,'day')+1 and t.create_time<=trunc(sysdate,'day')+6   

本周(国内周一为一个星期第一天)
Sql代码 复制代码
  1. where t.create_time >=trunc(next_day(sysdate-8,1)+1) and t.create_time<=trunc(next_day(sysdate-8,1)+7)+1  
posted on 2009-06-29 13:35  poop  阅读(537)  评论(0编辑  收藏  举报