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
Debra Price 25Debra Price 25 

Need to avoid multiple Or clauses in a query if possible. Object Contact

I'm using Dataloader to export data and need to limit the OR's in my query, because I have so many data fields in the where clause. is there a way to use the In clause for two or more fields for example or possibly a query with a sub query in dataloader?
Object = Contact
Where Clause Fields
  • name
  • Email
  • Email2__c
  • Email3__c
  • Email4__c
Basic Query
Select id, name, account.name, MobilePhone, HomePhone, OtherPhone, Email, Email2__c, Email3__c, Email4__c, accountid
from contact
(name = 'Abdulaziz Al-Saleh' and ( email='Abdulaziz.Al-Saleh@samba.com' or email2__c='Abdulaziz.Al-Saleh@samba.com')) or
(name = 'Abdullah Al-Rasheed' and ( email='Abdullah.Al-Rasheed@samba.com' or email2__c='Abdullah.Al-Rasheed@samba.com')) or
(name = 'alison@lakemoreuk.com' and ( email='alison@lakemoreuk.com' or email2__c='alison@lakemoreuk.com')) or
(name = 'Amjad Showail' and ( email='Amjad.Showail@samba.com' or email2__c='Amjad.Showail@samba.com'))

There are many more OR clauses to follow. I would like to avoid all the OR clauses however i need both the name and the temail addresses in  the where clause.
Rakshana Cube84Rakshana Cube84
Hi Debra,

You can use IN in the query to avoid a lot of OR clauses.
Select id, name, account.name, Email from contact where email in ('Abdulaziz.Al-Saleh@samba.com','Abdullah.Al-Rasheed@samba.com','Abdullah.Al-Rasheed@samba.com')

Thanks,
Rakshana 
Cube84.