Home > database >  Pray god to help solve the problem of the according to time get online time
Pray god to help solve the problem of the according to time get online time

Time:10-14

Set employees to work time is 9-18:00, system records staff to complete the business time, if no new business in two hours after the completion of the as rolled off the production line, if you have any new business is completed, the completion time, the new business until 18:00, work as a staff at 10 a.m., 11, 14 points, 17 each completed a business, 18 points to go off work, the online time for the (1 + 2 + 2 + 1), o great god help

CodePudding user response:

Online, such as

CodePudding user response:

 with tab1 as (
The select 10 dt from dual union all
Select 11 dt from dual union all
The select 14 dt from dual union all
The select 17 dt from dual
)
Tab2 as (
Select the case when the t1. Dt & gt; 18 then 0 else
Further (further (NVL (lead (t1) dt) over (order by t1. Dt), 18), 18) - t1, dt, 2)
End tt
The from tab1 t1
)
Select sum (t1. Tt) from tab2 t1
  • Related