Created
June 29, 2023 15:39
-
-
Save airburst/f2db7bde71e4f5290a6065c81ffc75ea to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Get all of today's rides that have no riders | |
SELECT r.id from Ride r | |
LEFT OUTER JOIN ( | |
SELECT rideId, CAST(count(*) as UNSIGNED) cnt | |
FROM UsersOnRides | |
GROUP BY rideId | |
) ur ON ur.rideId = r.id | |
where DATE_FORMAT(r.date,'%d/%m/%Y') = DATE_FORMAT(NOW(),'%d/%m/%Y') | |
and COALESCE(ur.cnt,0) = 0; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment