sql语句查找最近一个月的信息条数

xia20021 2008-01-04 01:51:57
会的来帮个忙..谢谢咯..
...全文
567 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
xia20021 2008-01-07
  • 打赏
  • 举报
回复
谢谢高手chenqingyu和mantisXF的帮忙.问题解决了!
mantisXF 2008-01-04
  • 打赏
  • 举报
回复
如果是从当前时间到前一个月的这个时候之间的记录总条数:

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');
chenqingyu 2008-01-04
  • 打赏
  • 举报
回复
select count(*) from uis_md_stcustom
where firsttime >= trunc(add_month(sysdate,-1),'mm')
and firsttime < trunc(sysdate,'mm')
xia20021 2008-01-04
  • 打赏
  • 举报
回复
哪位高手来帮帮忙呀...表名为uis_md_stcustom 时间字段为firsttime怎么样用当前时间开始查找出前一个月的记录总条数?
heyixiang 2008-01-04
  • 打赏
  • 举报
回复
?

17,086

社区成员

发帖
与我相关
我的任务
社区描述
Oracle开发相关技术讨论
社区管理员
  • 开发
  • Lucifer三思而后行
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧