I have a problem that can be simulated with a system much like SO's: posts and tags. To get my posts, I might do something like this:
SELECT title, body, author FROM posts WHERE id = ?
And then get my tags very simply
SELECT tag_id FROM tags_on_posts WHERE post_id = ?
Let's say I have a limit like SO does where you can only have 5 tags per post. Is there anyway I can do this in a single query?
SELECT title, body, author, tag1, tag2, tag3, tag4, tag5
FROM posts
JOIN /*help*/
WHERE id = ?