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
Ahmad HelalAhmad Helal 

Using OR Logic in SOQL

I have an object I need to query that has a reltionship to the opportunity object.

I need to find records that are related to a specfic set of opportunties (15 different opportunties)

Do I have to type out 

WHERE Opportunity__c = '006XXXXXXXX' OR Opportunity__c = '006XXXXXXXX' OR WHERE Opportunity__c = '006XXXXXXX' 15 times?

Is it possible to do something similar to fomrulas where you can do Opportunity__c = OR (Value1, Value1, Value3, etc)
Best Answer chosen by Ahmad Helal
pconpcon
you can do
 
where Opportunity__c in ('006xxxx1', '006xxxx2', '006xxxx3')

 

All Answers

pconpcon
you can do
 
where Opportunity__c in ('006xxxx1', '006xxxx2', '006xxxx3')

 
This was selected as the best answer
Ahmad HelalAhmad Helal
Thanks a ton @pcon ! Exactly what I needed =)