For setting query conditons, along wit AND/OR, parenthesis must also used often. Some examples of conditons:
Code:
...WHERE field1 = Value1 AND field2 = Value2 (returns all records where both conditions are TRUE)
...WHERE field1 = Value1 OR field2 = Value2 (returns all records where at least one condition is TRUE)
...WHERE field1 = Value1 OR field1 = Value2 (returns all records where either of conditions is TRUE)
...WHERE field1 IN (Value1,Value2) (a shorter version of previous example)
...WHERE field1 = Value1 AND field1 = Value2 (returns always nothing)
...WHERE field1 = Value1 OR (field1 = Value2 AND Field2) = Value3 (returns all recrods where 1st condition for Field1 is TRUE without any limitaions for Field2 - or both 2nd condition for Field1 and condition for Field2 are true)
e.t.c.