例如:表a,有三列数,id,name,createdate 要求是查出所有本月的记录数

解决方案 »

  1.   


    select * from 表a
    where trunc(createdate,'month')=trunc(sysdate,'month')
      

  2.   


    select * from a
    where time between '2011-01-01'and '2011-01-31';
    这样也可以的
      

  3.   

    select * from 表a
    where trunc(sysdate,'month')=trunc(createdate,'month')sysdate放在前面
      

  4.   

    select count(docid) as letterMonthProcessedTotal from wsxf_document where create_date <=(select to_char(last_day(sysdate),'yyyy-MM-dd') from dual
      

  5.   

    select id,name,createdate from a  where createdate>=trunc(sysdate,'mm')