我有一个表“BinaryTree”,它有2列“CustomerID”和“ParentID”。sql查询获取Spacetree数据(jit)
另一台是“客户”,它有列“”客户ID”和‘名字’。
我想从这些表中查询数据,并想JSON格式分配这些数据Spacetree。
请有下面的链接的参考: -
http://philogb.github.io/jit/static/v20/Jit/Examples/Spacetree/example1.code.html
http://philogb.github.io/jit/static/v20/Jit/Examples/Spacetree/example1.html
我想要的数据如下所示: -
Parentid CustomerID FirstName
1 34 Test1
1 64 Test2
1 46 Test3
34 45 Test4
34 102 Test5
64 22 Test6
46 54 Test7
因此,我可以构建JSON字符串并将其分配给spacetree。 如果它按顺序返回数据,我会很好,它意味着它首先返回所有的孩子。
之后,它会逐个返回这些childerns的子节点,因此很容易以spacetree想要的适当格式构建json字符串。
如果需要更多信息,请让我知道。
在此先感谢你们。
感谢@Vijay,这是给结果如下http://www.evernote.com/shard/s364/sh/3ca8dee4-8157-4531-87b9-fb910df6709c/1faff5c73dba42c0d3301f3d1a94062e,因为第1个有2个customerid(意味着2个孩子),所以它的第一个customerid是3,所以我想要在第4行的第7和第8行以及第5和第6行的下面parentid 3.希望你能帮上忙。 – AnandMeena
@AnandMeena:更新答案,按顺序添加custid –
坦克@Vijay,现在工作正常:-) – AnandMeena