Re: [sqlite] The last records of a query

2011-06-26 Thread Cecil Westerhof
2011/6/25 Max Vlasov > Use ORDER BY ... DESC. Sure, if you have a large dataset, it'd better be > indexed. > At the moment it is not a large dataset, but it is better to be prepared. I have the following definition: CREATE TABLE IF NOT EXISTS weights ( id

Re: [sqlite] The last records of a query

2011-06-26 Thread Cecil Westerhof
2011/6/25 Kees Nuyt > >selectStr=" > >SELECT categories.desc > >,weights.measureDate > >,weights.weight > >,weights.fat > >,weights.water > >,weights.muscle > >FROM weights > >,categories

Re: [sqlite] The last records of a query

2011-06-25 Thread Kees Nuyt
On Sat, 25 Jun 2011 19:42:11 +0200, Cecil Westerhof wrote: >Thanks for the answers. I had thought about both options, but was wondering >if I had missed something better. I original opted for the LIMIT/OFFSET >option (because the order is important), but after following

Re: [sqlite] The last records of a query

2011-06-25 Thread Cecil Westerhof
2011/6/25 Cecil Westerhof > With LIMIT you can get the first N records of a SELECT. Is it also possible > to get the last N records? > Thanks for the answers. I had thought about both options, but was wondering if I had missed something better. I original opted for the

Re: [sqlite] The last records of a query

2011-06-25 Thread Kees Nuyt
On Sat, 25 Jun 2011 09:26:42 +0200, Cecil Westerhof wrote: > With LIMIT you can get the first N records of a SELECT. > Is it also possible to get the last N records? Yes, I can think of two ways: 1- Reverse the ORDER BY (make it DESC), so you can use the exact same

Re: [sqlite] The last records of a query

2011-06-25 Thread Roger Andersson
On 06/25/11 09:26 AM, Cecil Westerhof wrote: > With LIMIT you can get the first N records of a SELECT. Is it also possible > to get the last N records? Search for LIMIT/OFFSET on http://www.sqlite.org/lang_select.html /Roger ___ sqlite-users mailing

Re: [sqlite] The last records of a query

2011-06-25 Thread Max Vlasov
On Sat, Jun 25, 2011 at 11:26 AM, Cecil Westerhof wrote: > With LIMIT you can get the first N records of a SELECT. Is it also possible > to get the last N records? > > Use ORDER BY ... DESC. Sure, if you have a large dataset, it'd better be indexed. Max

[sqlite] The last records of a query

2011-06-25 Thread Cecil Westerhof
With LIMIT you can get the first N records of a SELECT. Is it also possible to get the last N records? -- Cecil Westerhof ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users