【Leetcode-Mysql】Trips and Users

思路不总结了,看过题目自己尝试过之后,看下方代码应该能理解的

SELECT
Request_at AS DAY,
round(
sum(
CASE
WHEN STATUS = 'completed' THEN
0
ELSE
1
END
) / count(Id),
2
) AS 'Cancellation Rate'
FROM
Trips
WHERE
Client_Id IN (
SELECT
Users_Id
FROM
Users
WHERE
Banned = 'NO'
AND Role = 'client'
)
AND Request_at >= '2013-10-01'
AND Request_at <= '2013-10-03'
GROUP BY
Request_at;

  

上一篇:centos svn快速搭建


下一篇:(step5.1.2)hdu 2473(Junk-Mail Filter——并查集)