When you run a query against a Microsoft SQL Server Compact 3.5 database, an incorrect result is returned. This issue occurs when the query contains a conjunction and a disjunction. If we assume that the operators are AND and OR, the query must meet the following specific conditions:
One of the operands of the AND operator is an expression that contains the OR operator.
The operands of the OR operator contain expressions that reference the same column. Therefore, an index of the column can be used to match the expressions.
The other operand of the AND operator contains a reference to a column that uses the same index as the column that is specified in the previous bullet point in this list. Therefore, the index can be also used on this expression.
For example, assume that you create the following tables that use indexes in a SQL Server Compact 3.5 database.
CREATE TABLE T1( C1 int, C2 int)GOCREATE INDEX IND_T1 ON T1 (C1, C2)GOCREATE TABLE T2( C1 int, C2 int)GOCREATE INDEX IND_T2 ON T2 (C1, C2)GOINSERT INTO T1 VALUES (1, 0)GOINSERT INTO T1 VALUES (2, 0)GOINSERT INTO T2 VALUES (1, -1)GOINSERT INTO T2 VALUES (2, 0)GO