On 27 Dec 2011, at 5:36pm, Igor Tandetnik wrote:

> On 12/27/2011 12:17 PM, Bo Peng wrote:
>> sqlite selects all ids before it uses B-TREE for DISTINCT. Is there a
>> way to tell sqlite to return an id when it founds the first range that
>> the id falls into?
> 
> Without a temporary set to store the IDs it has already retrieved, how do you 
> expect SQLite to figure out whether a given range is in fact the first one a 
> given ID falls into?

Yeah.  You do need to store the results.  If you use

INSERT OR IGNORE

(or some equivalent way of keeping only the first found result) you can kind of 
hack it by relying on how SQLite uses indexes, but it is a hack and might fail 
in some future version of SQLite.

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

Reply via email to