Jakub Adamek <[EMAIL PROTECTED]> writes: > Hello, please, is there any way to make SQLite use an index on two > columns when I want to select all rows which have some combination of > the two columns? > > My table is: > CREATE TABLE PointFeature ( > DSetId INTEGER, > SectId INTEGER, > PntItemId INTEGER); > > CREATE INDEX xxx ON PointFeature (DSetId, SectId, PntItemId); > > and the query is > SELECT * FROM PointFeature WHERE > DsetId=203 AND SectId IN (4,400); > > But the index is used just to find the DsetId and not to find SectId. > Is there another form of the SQL which could do that? Or do I have to > use two separate queries
Try this instead: SELECT * FROM PointFeature WHERE DsetId=203 AND (SectId = 4 OR SectId = 400); Derrell