You need to sign in to do that
Don't have an account?
Dev_Arya
why this query with And clause in Where fails?
hi all,
the soql in the following code is failing. Could somebody explain this to me.
Thanks.
the soql in the following code is failing. Could somebody explain this to me.
Map<Id, String> profileIds = new Map<Id, String>(); profileIds.put('00eee000000xxxx','System Administrator'); profileIds.put('00eee00000yyyyy','YYY Profile'); profileIds.put('00eee00000zzzzz','ZZZ Profile'); List<User> users = [SELECT Id, Name, Email, ProfileId FROM User WHERE NOT(Email like '%@example.com') AND ProfileId NOT IN :profileIds.keySet()]; System.debug(users.size()); for (User usr: users) { System.debug(usr.id+' '+usr.Email); }Where i remove one of the clause from the where statement, it works.
Thanks.
Please check below code :
Hope this Helps you.
Thanks
Varaprasad
All Answers
Please check below code :
Hope this Helps you.
Thanks
Varaprasad
Try to update your query like below
SELECT Id, Name, Email, ProfileId FROM User WHERE ( NOT(Email like '%@example.com') ) AND (ProfileId NOT IN :profileIds.keySet() ) limit 1
Update your code like below
Let us know if this will help you