sql10(Leetcode1661每台机器的进程平均运行时间)

代码:

avg 字段平均值

avg+group by分组字段平均值

# Write your MySQL query statement below
select 
    machine_id,
    round(avg(if(activity_type='start',-timestamp,timestamp))*2,3)processing_time
from Activity 
group by machine_id

你可能感兴趣的:(leetcode)