Join users twice and aggregate cancellations
SELECT
request_at AS Day,
ROUND(
SUM(CASE WHEN status <> 'completed' THEN 1 ELSE 0 END) * 1.0
/ COUNT(*),
2
) AS "Cancellation Rate"
FROM trips t
JOIN users c
ON t.client_id = c.users_id
JOIN users d
ON t.driver_id = d.users_id
WHERE c.banned = 'No'
AND d.banned = 'No'
AND request_at BETWEEN '2023-10-01' AND '2023-10-03'
GROUP BY request_atThis is the clearest version for most readers. The joins enforce the unbanned-user constraint for both roles, and the CASE expression turns each trip into a 1 or 0 cancellation flag before averaging by day.