title: MySQL category with parent_id - SELF Join
body: <p>My SQL table called <code>categories</code> has the following structure:</p>
  
  <pre><code>CREATE TABLE categories(
     id int NOT NULL AUTO_INCREMENT,
     parent_id int,
     name varchar(50),
     PRIMARY KEY(id)
  );
  </code></pre>
  
  <p>I would like to know if it's possible to JOIN the same table and present the <code>parent_id</code> name. I can do this by PHP code, but I would like, because of performance issues, to retrieve as SQL Query.</p>
  
  <p><strong><a href="http://sqlfiddle.com/#!2/b0ee23/4" rel="nofollow">See example at SQLFiddle</a></strong></p>
  
  <p>I've managed to JOIN the table, but somehow the values aren't right. For example, the result of SQLFiddle retrieves:</p>
  
  <pre><code>    ID |    Name     | Parent Category Name
     -----------------------------------
      1       Meats          Steaks
  </code></pre>
  
  <p>Which is wrong, it should be:</p>
  
  <pre><code>    ID |    Name     | Parent Category Name
     -----------------------------------
      3       Steaks         Meats
  </code></pre>