On Sat, 25 Jun 2011 19:42:11 +0200, Cecil Westerhof <cldwester...@gmail.com> 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 the link I >found that this will be an ineffective way in the long run. That is way I >choose the DESC way in combination with tac. (I am using a bash script.): You're welcome. > selectStr=" > SELECT categories.desc > , weights.measureDate > , weights.weight > , weights.fat > , weights.water > , weights.muscle > FROM weights > , categories > WHERE categories.desc = 'Cecil' > AND weights.categoryID = categories.id > ORDER BY weights.measureDate DESC > LIMIT ${SHOW_NUMBER} > ; > " > for record in $(echo "${selectStr}" | sqlite3 ${DATABASE} | tac) ; do If you like, you can tac in SQL: selectStr=" SELECT * FROM ( SELECT categories.desc , weights.measureDate , weights.weight , weights.fat , weights.water , weights.muscle FROM weights , categories WHERE categories.desc = 'Cecil' AND weights.categoryID = categories.id ORDER BY weights.measureDate DESC LIMIT ${SHOW_NUMBER} ) ORDER BY weights.measureDate ; " -- ( Kees Nuyt ) c[_] _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users