> Le 10 avr. 2018 à 13:20, Clemens Ladisch <clem...@ladisch.de> a écrit :
> 
>> select NAME,count(NAME) from SHEETS group by NAME having SHEET>? and NAME is 
>> not NULL;
> 
> The SHEET value is from some random row in the group, and the NAME value is
> the same for all rows in the group.  Are you sure you do not want to use WHERE
> instead of HAVING?

Thanks for the hint, Clemens.
Would you mean:

  select NAME,count(NAME) from SHEETS where SHEET>? group by NAME having NAME 
is not NULL;

is more logically appropriate? I'm inclined to think yes and that was what you 
meant.

Or that I might even go for:

  select NAME,count(NAME) from SHEETS where SHEET>? and NAME is not NULL group 
by NAME;

On a test table with statistically representative values (only ~95'000 rows), I 
get the same plan in all three cases:

  --EQP-- 0,0,0,SEARCH TABLE SHEETS USING COVERING INDEX SHEETS_NAME (NAME>?)


-- 
Best Regards, Meilleures salutations, Met vriendelijke groeten,
Olivier Mascia


_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to