title: Find children users from two levels
body: <p>I have a table of users, most of the users have column <code>parent_id</code> set, that describes the ID of his parent. From that information, I want to generate a table for current user to display all his children and simultaneously all their children (2 levels). It's the most basic query to select all of users children, but I don't know how to select their children too in one query, I tried different kinds of unions but mostly got empty or malformed results, Im not very experienced with more complicated SQL queries.</p>
  
  <p>I made a <a href="http://sqlfiddle.com/#!9/38298b/1" rel="nofollow noreferrer">SQL Fiddle</a> of a minimal example. In the result, I would like to display user "BBB" as a child of "AAA" and also "CCC", because it's a child of a child of "AAA" (current user)</p>
  
  <p>Thank you for any help</p>
  
  <p>Sample data:</p>
  
  <pre><code>id  | nickname | parent_id
  1   |   AAA    |   null
  2   |   BBB    |    1
  3   |   CCC    |    2
  </code></pre>
  
  <p>Desired result for user AAA would be:</p>
  
  <pre><code>id  | nickname | parent_id
  2   |   BBB         1
  3   |   CCC    |    2
  </code></pre>