I am trying the following query:
return mDb.query(DATABASE_TABLE1, asColumnsToReturn,
"NotificationDateFor like ?
OR FriendsName like ?" +"
AND TypeNotification <> 'Event'
AND RadioType <> '3'
ORDER BY DateToNotify ASC",
new String[] { value, value }, null,null, null);
However I observe that in this case the part which corresponds to:
AND TypeNotification <> 'Event' AND RadioType <> '3'
Is being neglected. What could be the reason?
As can be seen in the documentation, AND has a higher precedence than OR, so a NotificationDateFor
match is enough to select a row:
sqlite> select 1 or 0 and 0 and 0;
1
You have to use parentheses:
(NotificationDateFor LIKE ? OR FriendsName LIKE ?) AND TypeNotification <> 'Event' AND RadioType <> '3'