Created
November 1, 2013 15:16
-
-
Save workmaster2n/7266949 to your computer and use it in GitHub Desktop.
join sql
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 tracked_points.worker_id, zones.id, zones.name, COUNT(*) FROM tracked_point_zones | |
| INNER JOIN zones | |
| ON zones.id = tracked_point_zones.zone_id | |
| INNER JOIN tracked_points | |
| ON tracked_points.id = tracked_point_zones.tracked_point_id | |
| GROUP BY tracked_points.worker_id, zones.id | |
| ORDER BY tracked_points.worker_id, COUNT(*) DESC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment