title: Join with another table containing tags
body: <p>I have a table called "posts" with the following struture:</p>
  
  <pre><code>post_id  |  post_body  | post_posterid
  </code></pre>
  
  <p>And I have another table called "tags":</p>
  
  <pre><code>tag_id  |  tag_name
  </code></pre>
  
  <p>A third table stores the relation between the two tables (will have multiple tags_id for each post_id as separate records):</p>
  
  <pre><code>post_id  |  tag_id
  </code></pre>
  
  <p>This is similar to stackoverflow's tagging that i am trying to create.</p>
  
  <p>But I do not know how to join the tables and to concatenate tags for each post, in a single record. Like this:</p>
  
  <pre><code>post_id  |  post_body  |  post_postername  |  tag_id1  |  tag_id2  |  tag_id3  ..... tag_name1  |  tag_name2  | tag_name3 ....
  </code></pre>
  
  <p>So while fetching from mysql using PDO, I can avoid further queries to get tag names.</p>
  
  <p><strong>EDIT</strong>
  More details:</p>
  
  <p>First table("posts") contains post id(a unique id), posted message and poster's id(unique poster id which is stored in table "poster").
  Second table "tags" contains possible tags(like "php", "vb.net", etc. like in stackoverflow) with unique tag_id.
  Third table contains the relation between posted message and tags. So it contains post_id and its corresponding tag_id. It is possible to have more than 1 tag assigned to same post.</p>
  
  <p>What i want: when queried, i can join "posts" with "posters" table to get name. But i want to get tags for each posts also.</p>
  
  <p>GROUP_CONCAT() is answer for my question. But how to obtain it as tag_id - tag_name pair, instead of all tag_id in a field and all tag_name in another.</p>
  
  <p>Eg: <code>1-VB , 5-PHP , 19-SQL</code></p>
  
  <p>I will separate this pairs in PHP</p>
  
  <p>What i am trying is same as stackoverflow's tagging system.</p>