ORACLE SQL Running TOTAL and daytotal using window function

别等时光非礼了梦想. 提交于 2019-11-30 23:46:37
select trunc(hired), 
       count(*) hired_today,       
       sum(count(*)) over (order by trunc(hired)) as running_total
from emp
group by trunc(hired)

http://sqlfiddle.com/#!4/4bd36/9

select trunc(hire_date), 
       count(*) over (partition by trunc(hire_date)) as hired_per_day,
       count(*) over (order by hire_date) as total_number_of_employees
from employee
order by trunc(hire_date)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!