17,086
社区成员
发帖
与我相关
我的任务
分享
如果是从当前时间到前一个月的这个时候之间的记录总条数:
select count(1)
from uis_md_stcustom u
where firsttime between add_months(sysdate,-1) and sysdate;
如果是求当前时间的前面一个月的内的记录总条数:
select count(1)
from uis_md_stcustom u
where to_char(firsttime,'mm') = to_char(add_months(sysdate,-1),'mm');
select count(*) from uis_md_stcustom
where firsttime >= trunc(add_month(sysdate,-1),'mm')
and firsttime < trunc(sysdate,'mm')