You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: MP SELECT Ancestors.md
+35
Original file line number
Diff line number
Diff line change
@@ -81,3 +81,38 @@ SELECT * FROM ancestors;
81
81
~~~
82
82
83
83
Blocks *json_nodes* through *tops* constitute the same prologue as [before](select-desc#prologue). The *prefixes* block retrieves node prefixes from the *categories* table (alternatively, prefixes could be calculated from the input by stripping the last path parts). *json_prefixes* prepares "nested doll" JSON objects, and the *ancestors* block generates ancestor lists. The last block temporarily escapes any periods in names by replacing them with '^#^' at the beginning and performing the inverse replacement at the end.
json_tree(replace(jo.json_obj, '.', '^#^')) AS terms
113
+
WHEREterms.parentIS NOT NULL
114
+
)
115
+
SELECT*FROM ancestors;
116
+
~~~
117
+
118
+
This query splits paths as provided and no longer accesses the *categories* table. The _nodes_ block also labels paths with array element id generated by _json_each_ instead of *ascii_id*.
0 commit comments