title: Select all tag assignments from latest 5 posts
body: <p>I have three tables:</p>
  <ol>
  <li><code>post</code> (id) - has all the entries</li>
  <li><code>tag</code> (id) - has all the tags</li>
  <li><code>assign</code> (post_id,tag_id) - assigns tags to posts, may have multiple rows for a post</li>
  </ol>
  <p>This is what I have so far:</p>
  <blockquote>
  <p>$sql_post = mysql_query(&quot;SELECT title,content,time,web FROM post ORDER BY time DESC LIMIT 5&quot;);</p>
  <p>$sql_tag = mysql_query(&quot;SELECT tag.name,tag.id,post.id FROM assign LEFT JOIN tag ON assign.tag_id=tag.id LEFT JOIN post ON assign.post_id=post.id WHERE post.time&gt;(SELECT MIN(time) FROM (SELECT time FROM post ORDER BY time DESC LIMIT 6) two)&quot;);</p>
  </blockquote>
  <p>I was thinking of putting it all into one big array, so something like this (sloppy summary):</p>
  <pre><code>array(
      post_id =&gt; array(
          &quot;title&quot; =&gt; &quot;post's title...&quot;,
          &quot;content&quot; =&gt; &quot;post's content...&quot;,
          &quot;tag&quot; =&gt; array(
              tag_id =&gt; &quot;tag 1's name&quot;,
              tag_id =&gt; &quot;tag 2's name
  </code></pre>
  <p>...and then using foreach's to display them on my blog.</p>
  <p>Where I need help is the sql for <code>$sql_tag</code>. How do I make it so that it selects all of the assignments for the latest 5 posts? It only selects one tag for a post.</p>