`

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

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics