No, use ORDER BY

Neville Franks wrote:
> If I use two columns for a key (primary or separate index) and query
> just on the first column component will I always get back the first
> match in a set. For example.
> 
> -----
> create table mytable ( clm1 text collate nocase, clm2 text collate nocase, 
> constraint mycs1 primary key( clm1, clm2 ) );
> 
> insert following:
> Clm1  Clm2
> abc   123
> abc   456
> abc   789
> def   123
> def   456
> def   789
> 
> select * from table where clm1='def';
> -----
> 
> Will the returned row always be def - 123. ie. the first row for def?
> 
> I've looked at the query plan for this select and it does use the
> index if clm1 alone is in the query and it appears to match on the
> first row.
> 
> Also my tests indicate I do get back the first matching row. But I'd
> like confirmation if possible.
> 

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

Reply via email to