ORACLE SQL Running TOTAL and daytotal using window function

前端 未结 2 962
萌比男神i
萌比男神i 2021-01-06 11:49

From the EMPLOYEE table, I want to group the amount of records(employees hired) AND also have the running TOTAL per day. The format of the input is like this:

row         


        
2条回答
  •  渐次进展
    2021-01-06 12:20

    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

提交回复
热议问题