Skip to main content

All Questions

0 votes
1 answer
476 views

SQLite Recursive Function

I have a view in SQLite where two columns need to follow a recursive formula. Example input data is below: Date Ca Cb Cc 2020-01-01 NULL NULL 100.0 2020-01-02 0.1 NULL NULL 2020-01-03 0.2 NULL NULL ...
Gohawks's user avatar
  • 1,134
-1 votes
1 answer
327 views

recursive query sqlite3.OperationalError: near "SELECT": syntax error

So I have the following recursive WITH RECURSIVE length(len, id, ord) AS ( SELECT 0, t.id, 1 FROM temp t UNION SELECT len + compute( SELECT w2.nodeid FROM waypoint w2 ...
saji's user avatar
  • 7
0 votes
1 answer
85 views

How to recursively retrieve towns available?

I am making a transportation application, and right now, I am implementing the SQL and writing some queries. I have a table Train(From, To), which is basically a table that has two columns. The first ...
zakpruitt's user avatar
  • 322
4 votes
1 answer
331 views

Recursively count occurrences with sqlite

Consider the following example table x_id name_id1 name_id2 x1 John Frank x2 Frank John x3 Jack John x4 John Jack x5 Bob Frank x6 George Bob x7 Bob Finn x8 Mark James x9 James Finn The goal is to ...
N Meibergen's user avatar
1 vote
2 answers
916 views

sqlite: how does order by in recursive queries work?

https://www.sqlite.org/lang_with.html#withorderby shows an example of how order-by on a recursion level can change Depth-First to Breadth-First ordering of a tree. Richard Hipp in http://sqlite....
Marek Wieckowski's user avatar
0 votes
1 answer
222 views

SQLite and recursive structures

This is continuation of question SQLIte and recursive data . Say I want to save trees in SQLite. Each node/leave has exactly the same data structure, but any 2 trees can share 0 or more nodes or ...
BorisV's user avatar
  • 699
2 votes
0 answers
119 views

Find possible paths with a recursive query

I've read this useful article related to SQL recursive queries. I want to do the same thing in Android and with SQLite. Here is the original query: WITH RECURSIVE search_path (path_ids, length, ...
Ehsan's user avatar
  • 400
4 votes
3 answers
2k views

SQL select descendants of a row

Suppose a tree structure is implemented in SQL like this: CREATE TABLE nodes ( id INTEGER PRIMARY KEY, parent INTEGER -- references nodes(id) ); Although cycles can be created in this ...
Joey Adams's user avatar
  • 43.5k