So

select count (*) from ...

Doesn't require a crystal ball and returns the number of rows but

Select count(*) from ... Limit x

Dies need one, interesting

On Saturday, 5 March 2016, Igor Tandetnik <igor at tandetnik.org> wrote:

> On 3/5/2016 12:20 PM, Paul Sanderson wrote:
>
>> If it computes many things and doesn't return many rows then I don't
>> really care. I only want to know how many rows a query will return
>> before I execute it in full.
>>
>
> That would require a crystal ball or a time machine. Absent those, it's
> impossible to know how many rows a query will produce until it actually
> runs and produces them.
>
> Again, you can wrap an arbitrary query like this:
>
> select count(*) from (
>   select whatever ...
> );
>
> This query always returns exactly one row and one column, with the value
> being the number of rows that the inner query would have returned. Is this
> not what you want? Of course, it would take approximately as much time to
> run this new query as it would the original query.
> --
> Igor Tandetnik
>
> _______________________________________________
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>


-- 
Paul
www.sandersonforensics.com
skype: r3scue193
twitter: @sandersonforens
Tel +44 (0)1326 572786
http://sandersonforensics.com/forum/content.php?195-SQLite-Forensic-Toolkit
-Forensic Toolkit for SQLite
email from a work address for a fully functional demo licence

Reply via email to