select  count(*)  count  from  mytable    
where  trunc(starttime,'mm')=trunc(sysdate,'mm');  
 

解决方案 »

  1.   

    我的starttime的格式是YYYYMMDDHHMMSS 20040922164000
      

  2.   

    谢谢大家,我的最新思路是:用like语句!select count(*) count from mytable
    where starttime like '200409%';
    当然这个200409取得的是系统时间。但是怎么获取系统的当前月份,表示成200409这种格式,需要讨论一下。
      

  3.   

    没注意你的字段类型
    :)
    starttime like to_char(sysdate,'yyyymm')||'%';
      

  4.   

    呵呵,谢谢 bzszp(www.bzszp.533.net) ,完整解决方案:select count(*) count from mytable
    where starttime like to_char(sysdate,'yyyymm')||'%';
    真高兴~
      

  5.   

    我的实际程序的PRO*C SQL 语句如下:(供参考) select count(*) count from mytable where (user = '13011223333') and (calltype = 1) and (starttime like to_char(sysdate,'yyyymm')||'%');
      

  6.   

    select  count(*)  count1  from mytable
    where  trunc(to_date(starttime,'yyyy-MM-dd hh24:mi:ss'),'mm')=trunc(sysdate,'mm') ;