日期:2014-05-16  浏览次数:20529 次

Oracle获取当天,当月,当年的数据

1. 当天 createdtime 参数

select? * from tablename t?where where trunc(sysdate)=trunc(t.createdtime);

2.当月 createdtime 参数

select * from tablename t where t.createdtime>=trunc(SYSDATE, 'MM') and t.createdtime<=last_day(SYSDATE)

?

3.当年 createdtime 参数
select * from table t??where t.createtime>=trunc(sysdate,'YYYY')??and t.createtime<=add_month(trunc(sysdate,'YYYY'),12)-1

?