title: Joining two tables (through a link), one which may yield multiple rows, together into one result
body: <p>Lets say I've got a table listing car brands or models:</p>
  
  <p><strong>Cars</strong>:</p>
  
  <pre><code>Id | Brand
  -----------
  1  | BMW
  2  | Audi
  3  | Volvo
  </code></pre>
  
  <p>And I've also got another table which links features.<br>
  <strong>Link</strong>:</p>
  
  <pre><code>Id | carid | featureid
  -----------------------
  1  | 1     | 1
  2  | 1     | 2
  3  | 2     | 2
  4  | 3     | 1
  5  | 3     | 2
  6  | 3     | 3
  </code></pre>
  
  <p>And I've got the table listing the features.<br>
  <strong>Features</strong>:</p>
  
  <pre><code>Id | Feature
  -----------
  1  | A/C
  2  | 4WD
  3  | Heated seats
  </code></pre>
  
  <p>I want to list these results on my front page like this:</p>
  
  <blockquote>
    <p><strong>BMW</strong></p>
    
    <ul>
    <li>A/C </li>
    <li>4WD</li>
    </ul>
    
    <p><strong>Audi</strong></p>
    
    <ul>
    <li>4WD</li>
    </ul>
    
    <p><strong>Volvo</strong></p>
    
    <ul>
    <li>A/C</li>
    <li>4WD</li>
    <li>Heated seats</li>
    </ul>
  </blockquote>
  
  <p>What's the best/most efficient way of doing this (using PHP and MySQL)?</p>
  
  <hr>
  
  <p><strong>Edit</strong>:
  I think I'm going to redesign my <code>Cars</code> database to look like this instead: </p>
  
  <pre><code>Id | Brand   | Feature
  ----------------------
  1  | BMW     | 1,2
  2  | Audi    | 1
  3  | Volvo   | 1,2,3
  4  | Citröen | 
  </code></pre>
  
  <p>And then fetch <code>Features</code> beforehand and combine in PHP. I guess it's much easier, and I don't get a problem if I have a brand without a feature.</p>