求sql语句

liujt17 2011-03-22 02:03:23
有一表A 里面有 字段 id 字段 create_date 现在想依据 create_date 查询 当前礼拜的 总id数目
...全文
47 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
Mark_MaoHUA 2011-03-22
  • 打赏
  • 举报
回复
select count(*) from A where create_date>next_day(sysdate,'星期日')-7
  • 打赏
  • 举报
回复

--以星期天为一周的开始
select count(*)
from a
where create_date between trunc(sysdate,'d') and trunc(sysdate,'d')+7


--以星期一为一周的开始
select count(*)
from a
where create_date between trunc(sysdate,'d')+1 and trunc(sysdate,'d')+8

17,377

社区成员

发帖
与我相关
我的任务
社区描述
Oracle 基础和管理
社区管理员
  • 基础和管理社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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