-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLeetCode262.sql
More file actions
30 lines (30 loc) · 767 Bytes
/
LeetCode262.sql
File metadata and controls
30 lines (30 loc) · 767 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
select request_at 'Day', ROUND(
SUM(
CASE
when status = 'completed' then 0
else 1
end
) / COUNT(*), 2
) 'Cancellation Rate'
from (
select request_at, status
from Trips
where
client_id in (
select users_id
from Users
where
role = 'client'
and banned = 'No'
)
and driver_id in (
select users_id
from Users
where
role = 'driver'
and banned = 'No'
)
and request_at between '2013-10-01' and '2013-10-03'
) t
group by
request_at;