Skip to content

Latest commit

 

History

History
11 lines (10 loc) · 455 Bytes

1661. Average Time of Process per Machine.md

File metadata and controls

11 lines (10 loc) · 455 Bytes

1661. Average Time of Process per Machine

Question Link

Solution

# Write your MySQL query statement below
select a1.machine_id, round(avg(a2.timestamp - a1.timestamp), 3) as processing_time
from Activity a1 join Activity a2
on a1.machine_id = a2.machine_id and a1.process_id=a2.process_id and a1.activity_type='start' and a2.activity_type='end'
group by a1.machine_id