title: sql query to get data for Spacetree (jit)
body: <p>I have a table "BinaryTree" and it has 2 columns "CustomerID" and "ParentID".</p>
  
  <p>Another table is "Customers" and it has columns  ""CustomerID" and "Firstname".</p>
  
  <p>I want to query data from these table and want to assign these data to Spacetree in Json format.</p>
  
  <p>Please have a reference of below links :-</p>
  
  <p><a href="http://philogb.github.io/jit/static/v20/Jit/Examples/Spacetree/example1.code.html" rel="nofollow">http://philogb.github.io/jit/static/v20/Jit/Examples/Spacetree/example1.code.html</a></p>
  
  <p><a href="http://philogb.github.io/jit/static/v20/Jit/Examples/Spacetree/example1.html" rel="nofollow">http://philogb.github.io/jit/static/v20/Jit/Examples/Spacetree/example1.html</a></p>
  
  <p>I want data something like below :-</p>
  
  <pre><code>Parentid  CustomerID  FirstName
     1          34         Test1
     1          64         Test2
     1          46         Test3
     34         45         Test4
     34         102        Test5
     64         22         Test6
     46         54         Test7
  </code></pre>
  
  <p>So I can build json string and assign it to spacetree.
  I would be good if it return data in order, means for a parentid it first return all its childrens.</p>
  
  <p>and after that it returns childrens of these childerns one by one, so it is easy to build json string in proper format that spacetree wants.</p>
  
  <p>Please let me know if further information needed.</p>
  
  <p>Thanks in advance guys. </p>