On Sat, Aug 28, 2010 at 12:14 PM, Paul Sanderson < sandersonforens...@gmail.com> wrote:
> > What I want to do is a second query on the dataset selecting 100 rows > before and after the current row and place them into a second > (temporary) table. > > Paul, maybe it's not about all aspects of your task, but getting 100 rows before and after some sorted value could be implemented like this (it's my table MxVft_FTWords containing id and word, word is indexed, here we get window records for 'word'): SELECT * FROM (SELECT * FROM MxVft_FTWords WHERE Word < 'TAKE' ORDER BY Word DESC LIMIT 100) UNION SELECT * FROM (SELECT * FROM MxVft_FTWords WHERE Word >= 'TAKE' ORDER BY Word LIMIT 100) ORDER BY Word I tried it on a real table containing about 1,3M records, EXPLAIN QUERY PLAN successfully reported about index usage, also vfs read was about 8 kilobytes, so no full-scan at all. Max Vlasov maxerist.net _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users