On 18 Mar 2010, at 9:05am, Fredrik Karlsson wrote: > I would like to make it possible to find 10 as a descendent of 8 and 6 > as a parent of 9 (for instance).
> I have found a couple of procedural solutions using procedural calls > in sql server or postgresql, but is there a solution that I could get > into sqlite? One that can be executed in one SQL query ? No. Not without adding more data to your database. It will almost definitely be faster and simpler to do this in your chosen programming language, ending with a table like this: CREATE TABLE levels_relatives ( id INTEGER UNIQUE, ancestors TEXT, descendants TEXT); The simplest way to do this is to make any number of changes to levels_levels, then delete and reconstruct the entire levels_relatives table either by programming in your programming language, or by using group_concat(X) to concatenate the values already present. Simon. _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

