sqlite实现树型结构的查询
分类:Database, Sqlite
阅读 (2,477)
Add comments
10月 312017
此方法不可用!!!
使用RowID
1 2 3 4 5 6 7 8 |
select id,bname,parentid,1 as Level from boxes where parentid=0 union all select a.id,a.bname,a.parentid,c.RowID as Level from boxes a inner join boxes b on a.parentid=b.id inner join ( select parentid from boxes group by parentid ) c on a.parentid=c.parentid |