Right now the below query returns 1 row for each result…. I need to show a list of tags for each row and I’m debating whether to change this query so it INNER JOINS the tags and parsing out the data on the PHP end, or if I should just run a separate query for each return result…. what are your thoughts on this? Should I pull the extra data and parse it on the PHP end or run additional queries (maybe 25-30)?
SELECT
content.id,
content_text.content
FROM content
INNER JOIN content_text ON (
content_text.content_id = content.id AND
content_text.language_id = 1
)
INNER JOIN tags_to_content ON (
tags_to_content.tag_id IN (1)
)
You could rely on a small command that is not used much in mysql :
GROUP_CONCAT().Official Doc for GROUP_CONCAT
Here is a small example (not based on your current question since I don’t know the specifics, its a example that could apply to a blog):
Which would return