function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Nin KumpraewpanNin Kumpraewpan 

SOQL guru please help

Hi,

I'm new to SOQL. I'm working on Lookup Rollup Summaries and on Relationship Criteria, I would to put condition where
A__c contains Apple
AND
B__c doesn't contain Bird

When I tried on code below, its doens't work
A__c LIKE '%Apple%' AND  
NOT(B__c LIKE '%Bird%')

But when I tried with one condition for each of them, its works perfectly.

Could you please help what have I done wrong please as I'm really new to SOQL

thank you
Best Answer chosen by Nin Kumpraewpan
Gaurav Sharma 472Gaurav Sharma 472
wrap the 2 logic inside parantheses then.

(A__c LIKE '%Apple%' )
AND  
(NOT(B__c LIKE '%Bird%'))

 

All Answers

Gaurav Sharma 472Gaurav Sharma 472
What error you are getting  
Nin KumpraewpanNin Kumpraewpan
A__c LIKE '%Apple%' AND  
NOT(B__c LIKE '%Bird%') is not valid.

error is 'expecting a right parentheses, found 'AND'
Gaurav Sharma 472Gaurav Sharma 472
wrap the 2 logic inside parantheses then.

(A__c LIKE '%Apple%' )
AND  
(NOT(B__c LIKE '%Bird%'))

 
This was selected as the best answer
Nin KumpraewpanNin Kumpraewpan
Thank you!