ORACLE SQL Running TOTAL and daytotal using window function

前端 未结 2 960
萌比男神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条回答
  •  梦毁少年i
    2021-01-06 12:27

    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)
    

提交回复
热议问题