8000 Update README.md · Learner457/sql-50-leetcode@45b2974 · GitHub
[go: up one dir, main page]

Skip to content

Commit 45b2974

Browse files
authored
Update README.md
1 parent 7f39c35 commit 45b2974

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,16 @@ FROM
103103
FROM Activity
104104
GROUP BY machine_id, process_id) AS subq
105105
GROUP BY machine_id
106+
107+
-- OR this is another approach but this put math expession in one go
108+
SELECT
109+
machine_id,
110+
round(SUM(CASE WHEN activity_type='start' THEN timestamp*-1 ELSE timestamp END)
111+
/ (SELECT COUNT(DISTINCT process_id)),3) AS processing_time
112+
FROM
113+
Activity
114+
GROUP BY machine_id;
115+
106116
```
107117

108118
[577 - Employee Bonus](https://leetcode.com/problems/employee-bonus/solutions/)

0 commit comments

Comments
 (0)
0