How to make recursive query in SQLite?

前端 未结 4 1643

if my data structure is like this

parentA
-------parentAA
--------------parentAAA
---------------------childA

if i can get \"childA.name\" . h

4条回答
  •  忘掉有多难
    2021-02-11 06:51

    SQLite doesn't support recursive CTEs (or CTEs at all for that matter),

    there is no WITH in SQLite. Since you don't know how deep it goes, you can't use the standard JOIN trick to fake the recursive CTE. You have to do it the hard way and implement the recursion in your client code:

    • Grab the initial row and the sub-part IDs.
    • Grab the rows and sub-part IDs for the sub-parts.
    • Repeat until nothing comes back.

提交回复
热议问题