Paul Sanderson wrote:
> I am trying to determine before a query is executed how many rows will
> be returned. the following query works as expected
>
> select count(*) from table
>
> but
>
> select count(*) from table limit 100
>
> still returns the number of rows in the table not the number of rows
> that would be returned by the query.

"The query" is the one that has the "limit" clause.  What else should
the database execute?

As documented <http://www.sqlite.org/lang_select.html>, the result rows
are generated before the LIMIT clause is applied.

To determine how many rows would be returned by an arbitrary query, use:

  SELECT COUNT(*) FROM (SELECT ...);


But why do you want to determine the number of rows in the first place?


Regards,
Clemens

Reply via email to