欢迎投稿

今日深度:

oracle SQL语句取本周本月本年的数据

oracle SQL语句取本周本月本年的数据


oracle SQL语句取本周本月本年的数据
 
[sql] 
--国内从周一到周日 国外是周日到周六  
select to_char(sysdate-1,'D') from dual;--取国内的星期几 去掉减一取国外的星期--  

 

[sql] 
--取本周时间内的数据  
select * from table  where DTIME >=trunc(next_day(sysdate-8,1)+1) and DTIME<=trunc(next_day(sysdate-8,1)+7)+1 ;  
  
select * from table  where DTIME >=trunc(next_day(sysdate-8,1)) and DTIME<=trunc(next_day(sysdate-8,1)+7);--国外的  
    
select * from table  where  DTIME >=TRUNC(SYSDATE, 'MM')  and DTIME<=last_day(SYSDATE);  
--本月的  
select * from table where to_char(DTIEM,'yyyy')=to_char(sysdate,'yyyy');  
--本年的  

 


www.htsjk.Com true http://www.htsjk.com/oracle/20803.html NewsArticle oracle SQL语句取本周本月本年的数据 oracle SQL语句取本周本月本年的数据 [sql] --国内从周一到周日 国外是周日到周六 select to_char(sysdate-1,D) from dual;--取国内的星期几 去掉减一取国外的星期...
相关文章
    暂无相关文章
评论暂时关闭