Results of 1 - 1 of about 1 for endNode (0.001 sec.)
- WITH Clause 9414
- The WITH clause allows you to specify common table expressions (CTEs). Regular (non-recursive) common-table-expressions are essentially views that are limited in scope to a particular query. CTEs can reference each other and can be nested.
...Enumerate All Paths from a Node The following query returns all paths starting in node 1: WITH RECURSIVE paths(startNode, endNode, path) AS ( SELECT -- Define the path as the first edge of the traversal node1id AS startNode, node2id AS endNode, [node1i...ROM edge WHERE startNode = 1 UNION ALL SELECT -- Concatenate new edge to the path paths.startNode AS startNode, node2id AS endNode, array_append(path, node2id) AS path FROM paths JOIN edge ON paths.endNode = node1id -- Prevent adding a repeated node to...the path. -- This ensures that no cycles occur. WHERE list_position(paths.path, node2id) IS NULL ) SELECT startNode, endNode, path FROM paths ORDER BY length(path), path; startNode endNode path 1 3 [1, 3] 1 5 [1, 5] 1 5 [1, 3, 5] 1 8 [1, 3, 8] 1 1... - https://man.mtool.work/duckdb/2.0/sql/query_syntax/with.html
PREV
1
NEXT
DuckDB 2.0 Documentation / man.mtool.work