Created
November 11, 2015 10:39
-
-
Save martintsch/d928ccdfe10e65972693 to your computer and use it in GitHub Desktop.
locations by vehicle id
This file contains hidden or 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
| SELECT * FROM locations l INNER JOIN (SELECT u.first_name, u.last_name, u.id as user_id, t1.id as vehicle_id, t1.regno FROM users u INNER JOIN (SELECT * FROM vehicles v WHERE sak_activated_at IS NOT NULL AND sak_deactivated_at IS NULL) t1 ON t1.user_id = u.id) t2 ON l.vehicle_id = t2.vehicle_id; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment