ROQL Sentence fetches wrong value
Flag1 & Flag2 is yes/no fields. Default value for flag2 was 'yes' before, now we changed to 'No value'.
I want fetch contact record with below mentioned 2 conditions
Condition 1 : flag1 is yes
Condition 2 : flag2 is no value (Default value) or flag2 is yes
Contact.CustomFields.c.flag2 from Contact
where Contact.CustomFields.c.flag1==1 AND (Contact.CustomFields.c.flag2 != 0 or Contact.CustomFields.c.flag2 == 'null') order by ID
In the above ROQL, even flag2 is equal to zero is also fetched. What is wrong in this ROQL sentence?