现有三个表,分别是父亲表tablea、儿子表tableb、孙子表tablec,其结构如下:
父亲表tableaaidnameage1赵60
2钱70
儿子表tablebbidaidnameheight11赵一170
21赵二175
32钱一180
42钱二185
孙子表tableccidbidnameweight11赵一1110
21赵一2115
32赵二1120
42赵二2125
53钱一1130
63钱一2135
74钱二1140
84钱二2145
条件只有父亲表tablea里面的['赵','钱'],现在想通过一条查询语句,返回['赵','钱']的所有后代的所有信息,以JSON三维数组呈现,如何实现?三维数组形如:[{
aid: 1,
name: '赵',
age: 60,
children: [{
bid: 1,
name: '赵一',
height: 170,
children: [{
cid: 1, name: '赵一1', weight: 110
},{
cid: 2, name: '赵一2', weight: 115
}]
},{
bid: 2,
name: '赵二',
height: 175,
children: [{
cid: 3, name: '赵二1', weight: 120
},{
cid: 4, name: '赵二2', weight: 125
}]
}]
},{
aid: 2,
name: '钱',
age: 70,
children: [{
bid: 3,
name: '钱一',
height: 180,
children: [{
cid: 5, name: '钱一1', weight: 130
},{
cid: 6, name: '钱一2', weight: 135
}]
},{
bid: 4,
name: '钱二',
height: 185,
children: [{
cid: 7, name: '钱二1', weight: 140
},{
cid: 8, name: '钱二2', weight: 145
}]
}]
}]