我有这样的查询
SELECT "SOME FIELDS"
FROM (SELECT "SOME FIELDS" FROM WHERE FIELD=VALUE1 AND FIELD=VALUE2)
CONNECT BY **PRIOR** FIELD1=FIELD2 START WITH FIELD=VALUE1
ORDER BY **FIELDS**
我有本教程,但我不明白
答案 0 :(得分:2)
Oracle"通过"连接在使用其他DBMS(符合SQL标准)时,需要将语法转换为递归公用表表达式。
SQLite支持自3.8.3版https://sqlite.org/lang_with.html
以来的递归CTE您的陈述将转换为以下内容:
with recursive my_tree as (
select column_1, column_2, column_3
from your_table
where field = value1 --- <<< this is the "start with part" in Oracle
union all
select c.column_1, c.column_2, c.column_3
from your_table c
join my_tree p
on p.field2 = c.field1 -- <<< this is the "prior ..." part in Oracle
)
select *
from my_tree
order by some_column;