题解 | 统计快递运输时长
统计快递运输时长
https://www.nowcoder.com/practice/bb4196936f15424dbabe76a501186d91
with type_hour as(
select et.exp_number,
et.exp_type,
TIMESTAMPDIFF(minute, ea.out_time, ea.in_time) / 60.0 as hour
from express_tb et inner join exp_action_tb ea
on et.exp_number = ea.exp_number)
select exp_type,
round(AVG(hour), 1) as time
from type_hour
group by exp_type
order by AVG(hour)