On Mon, Jul 24, 2006 at 09:13:28AM -0700, hanno wrote: > > Hello Jay! > > Assigning the ids outside sql wouldn't be neccessary because I could > easily see the predecessor and successors. You are completely right, > when you suggest a sql-external solution.
Do you mean that, you would like to do a query with an order by, and then in each row for that same query, easily refer to columns from OTHER (either earlier or later) rows in the ordered result set? If so, what you want are the very useful SQL:2003 "OLAP" functions for dealing with ordered data. These include "lead" and "lag", among others. But, SQLite does not support that. Oracle and DB2 do. FYI, here are some links to further discussion of the SQL:2003 OLAP functionality: "SQL:2003 OLAP/windowing functions?", 2006-01-25 http://sourceforge.net/mailarchive/forum.php?thread_id=9560540&forum_id=39803 "SQL Window/OLAP functions", Wed, 12 Oct 2005 http://www.mail-archive.com/sqlite-users@sqlite.org/msg10816.html "Re: [sqlite] Slow SQL statements", Mon, 23 May 2005 http://www.mail-archive.com/sqlite-users@sqlite.org/msg08223.html "Re: [sqlite] windowing functions != recursive functions", Thu, 13 Oct 2005 http://www.mail-archive.com/sqlite-users@sqlite.org/msg10855.html http://www.mail-archive.com/sqlite-users@sqlite.org/msg10854.html -- Andrew Piskorski <[EMAIL PROTECTED]> http://www.piskorski.com/