작성
·
246
0
FROM절이 아닌 WITH문을 사용하여 풀이했는데 답이 안나오네요. ㅠㅠ 어떤 점이 잘못되었는지 여쭤볼 수 있을까요?
WITH sub AS (
SELECT request_at,
SUM(CASE WHEN status != 'completed' THEN 1 ELSE 0 END) cancel_count,
COUNT(*) total_count
FROM Trips
INNER JOIN Users AS U1 ON Trips.client_id = U1.users_id
INNER JOIN Users AS U2 ON Trips.driver_id = U2.users_id
WHERE Trips.request_at BETWEEN '2013-10-01' AND '2013-10-03'
AND U1.banned = 'NO' AND U2.banned = 'NO'
GROUP BY request_at
)
SELECT request_at AS Day, ROUND(cancel_count/total_count,2) AS 'Cancellation Rate'
FROM sub;
이렇게 작성하면 소수점 이하 숫자가 안나와서 질문드렸어요!