You need to sign in to do that
Don't have an account?

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
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.
Object = Contact
Where Clause Fields
- name
- Email2__c
- Email3__c
- Email4__c
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.
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.