title: Self join within the table in mariaDB
body: <p>In mongo we will use lookup to find datas using foreign key. Here in mariaDB how to use join to fetch the record from the same table. In my code i'm using node to run the backed and sequlize to connect mariaDB</p>
  <p>Example:
  In a table called category there is relation between id and parentId. how to put join within the same table.</p>
  <pre><code>SELECT * FROM categories child WHERE id = 9 
  left join 'categories' parent ON 
  child.parentId = parent.id
  </code></pre>
  <p>Solution:</p>
  <pre><code>SELECT * FROM `categories` child 
  INNER JOIN `categories` parent ON
  child.parentId = parent.id 
  WHERE child.id = 9
  </code></pre>