SELECT COUNT(*) FROM table will always return exactly 1 record (with the count).
LIMIT 5000 limits the number of records returned to 5000. As 1 record < 5000 records the 5000 is effecively ignored -- Jos -----Original Message----- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Fabian Sent: zondag 16 oktober 2011 13:09 To: General Discussion of SQLite Database Subject: [sqlite] Limit COUNT How can you limit a count-query? I tried: SELECT COUNT(*) FROM table LIMIT 5000 But it ignores the LIMIT clause. I think the workaround would be counting the results of a sub-query, but I'm trying to understand whats wrong with the syntax above. The goal is to make the engine stop iterating after it reached the upper limit, in order to save performance. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users