title: Recursive sql select from unlimited nodes
body: <p>I have this table in sql:</p>
  
  <pre><code>TopicID      Code       Name       ParentID
  -------      ----       ----       --------
  1            001        Parent1       0
  2            001        Childp1       1
  3            002        Parent2       0
  4            001        Childp2       3
  5            001        Childp21      4
  .
  .
  etc
  </code></pre>
  
  <p>Now I want to 
  1.get sql select which retrives me the last node? (which I did by following line)</p>
  
  <pre><code>select * from accounting.topics where topicid not in(select parentid from accounting.topics)
  </code></pre>
  
  <p>and the result is:</p>
  
  <pre><code>TopicID      Code       Name       ParentID  |    newcolumn
  -------      ----       ----       --------  |   ---------
  2            001        Childp1       1      |    001001
  5            001        Childp21      4      |    002001001
  </code></pre>
  
  <p>2.Important one is to show the concat of code from first to last node of each row in above result,like newcolumn in above,Actually I can't produce the newcolumn ?
  *notice that the nodes level are unlimited.</p>