oracle 查询当月的数据

来源:互联网 发布:2018软件工程硕士在职 编辑:程序博客网 时间:2024/06/04 23:32

在oracle 中查询当月的数据 有两种方式:

            1. select t.*,t.rowid from 表名 t where t.create_time >=TRUNC(SYSDATE, 'MM') and to_char(t.create_time,'YYYY-MM-dd')<=to_char(last_day(SYSDATE),'YYYY-MM-dd');

           2.select t.*,t.rowid from 表名 t where  to_char(t.create_time,'YYYY-MM-dd') between to_char(sysdate,'YYYY-MM')||'-01' and to_char(last_day(SYSDATE),'YYYY-MM-dd');

0 0
原创粉丝点击