without join, use subquery and IN for where statement

  • 0

    Created at: a few seconds ago

    SELECT t.request_at AS Day,
    ROUND(COUNT(CASE WHEN t.status like 'cancelled_%' THEN 1 ELSE NULL END)/COUNT(t.status),2) AS "Cancellation Rate"
    FROM Trips t
    WHERE (t.request_at BETWEEN '2013-10-01' AND '2013-10-03' ) AND t.Client_id NOT IN (SELECT Users_Id FROM Users WHERE Banned = 'yes' )
    GROUP BY 1

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.