Created
January 23, 2012 07:26
-
-
Save drale2k/1661381 to your computer and use it in GitHub Desktop.
Selecting all locations
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 L.id, L.name, L.description, L.created_at, | |
GROUP_CONCAT( | |
DISTINCT CONCAT(C.lat, ":", C.lng) | |
ORDER BY C.coordinate_order ASC SEPARATOR ", " | |
) AS coordinates, | |
GROUP_CONCAT( | |
DISTINCT CONCAT(M.media_type, "#", M.media_url) | |
) AS media | |
FROM locations AS L | |
INNER JOIN locations_coordinates AS C ON L.id = C.location_id | |
INNER JOIN locations_media AS M ON L.id = M.location_id | |
WHERE L.id = C.location_id | |
GROUP BY L.id, L.name, L.description, L.created_at ASC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment