MySQL using subquery, currently beats 100%
ApproachI used min and max function to determine start timestamp and end timestamp.Code
# Approach
I used min and max function to determine start timestamp and end timestamp.

# Code
```mysql []
# Write your MySQL query statement below
select
    machine_id,
    round(avg(timespent),3) as processing_time 
from
    (select machine_id, max(timestamp) - min(timestamp) as timespent
    from activity
    group by machine_id, process_id) as tmp
group by
    machine_id
```


['MySQL']