学习时间:
2023年2月26日
题目描述:
题解分享:
# 作 者 : 繁 华 倾 夏
# 力扣(LeetCode):262. 行程和用户
# MySQL 数据库
select T.request_at as `Day`,
round(
sum(
if (T.STATUS = 'completed', 0, 1)
)
/
count(T.STATUS),
2
) as `Cancellation Rate`
from Trips as T
join Users as U1 on(T.client_id = U1.users_id and U1.banned = 'No')
join Users as U2 on(T.driver_id = U2.users_id and U2.banned = 'No')
where T.request_at between '2013-10-01' and '2013-10-03'
group by T.request_at