Sorry for the horrible title, not sure how to explain this. I have a query that looks like this:
SELECT `name`, `latitude`, `longitude`, `indoor`, `address`,
`phone`, `email`, `website`, `closed`
FROM rocks INNER JOIN
(SELECT DISTINCT id FROM rock_types WHERE type="DWS" or type="Top rope")
AS types ON rocks.id=types.id
WHERE (latitude>-180 AND latitude<180) AND (longitude>-180 AND longitude<180)
In addition to what I’m getting right now, I’d like to get the list of types associated with each id. How can I do this? Thanks
Here is my take using traditional join syntax:
The
rocks.id = rocks_types.iddoes the link between both tables.Here is how you can write the same query using
INNER JOIN(both leads to the same result)EDIT: Based on your comment, the following will give you a comma separated list of types: