On 11 May 2018, at 9:50pm, Deon Brewis <d...@mylio.com> wrote: > e.g. If you do: > > SELECT c1 from t1 ORDER BY c2 LIMIT 5; > > vs. just running the query without the "LIMIT" clause and taking the top 5 > rows programmatically?
The LIMIT clause just tells sqlite3_step() to return SQLITE_DONE after the fifth result. The only difference is whether you want to count to 5 in your own code or have SQLite do it for you. In practise, you may have a specific reason for wanting the limit to appear in the SQL command, or not wanting it there. It may be part of your business practise or it may be a detail of how your software works. Do whatever the reader would find easiest to understand. Remember in both cases to do sqlite3_finalize() or sqlite3_reset() once you have finished fetching results. Simon. _______________________________________________ sqlite-users mailing list email@example.com http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users