谢谢大家,我的最新思路是:用like语句!select count(*) count from mytable where starttime like '200409%'; 当然这个200409取得的是系统时间。但是怎么获取系统的当前月份,表示成200409这种格式,需要讨论一下。
没注意你的字段类型 :) starttime like to_char(sysdate,'yyyymm')||'%';
呵呵,谢谢 bzszp(www.bzszp.533.net) ,完整解决方案:select count(*) count from mytable where starttime like to_char(sysdate,'yyyymm')||'%'; 真高兴~
我的实际程序的PRO*C SQL 语句如下:(供参考) select count(*) count from mytable where (user = '13011223333') and (calltype = 1) and (starttime like to_char(sysdate,'yyyymm')||'%');
select count(*) count1 from mytable where trunc(to_date(starttime,'yyyy-MM-dd hh24:mi:ss'),'mm')=trunc(sysdate,'mm') ;
where starttime like '200409%';
当然这个200409取得的是系统时间。但是怎么获取系统的当前月份,表示成200409这种格式,需要讨论一下。
:)
starttime like to_char(sysdate,'yyyymm')||'%';
where starttime like to_char(sysdate,'yyyymm')||'%';
真高兴~
where trunc(to_date(starttime,'yyyy-MM-dd hh24:mi:ss'),'mm')=trunc(sysdate,'mm') ;