풀이
select a1.machine_id,
round(avg(a2.timestamp - a1.timestamp), 3) as processing_time
from Activity a1
join Activity a2 on a1.process_id = a2.process_id and a1.machine_id = a2.machine_id
where a1.activity_type = 'start' and a2.activity_type = 'end'
group by a1.machine_id
order by a1.machine_id
'Data > SQL' 카테고리의 다른 글
[Leetcode] 1045. Customers Who Bought All Products (0) | 2024.01.19 |
---|---|
[Leetcode] 175. Combine Two Tables, 178. Rank Scores, 184. Department Highest Salary (0) | 2024.01.15 |
[Leetcode] 602. Friend Requests II: Who Has the Most Friends (0) | 2024.01.09 |
[Leetcode] 1757. Recyclable and Low Fat Products (0) | 2024.01.08 |
[프로그래머스] 가격대 별 상품 개수 구하기 (0) | 2024.01.07 |