Tim Streater wrote: > On 05 Mar 2016 at 13:05, Clemens Ladisch <clemens at ladisch.de> wrote: >> But why do you want to determine the number of rows in the first place? > > In my case I want to know whether at least one row exists that has a certain > column which has a given value. At the minute I do this: > > select count(*) from mytable where status=1 limit 1; > > Would this: > > select count(*) from (select status from mytable where status=1 limit 1); > > or some other query be faster. Really, I'd like SQLite to stop after finding > one row.
So you want to know whether such a row exists? Then ask for that: SELECT EXISTS (select status from mytable where status=1); This returns a boolean value. Regards, Clemens