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
User SFDCUser SFDC 

SOQL with two IN in where clause with list as input

Hello All,

My query is ::
select id , name from account where name IN : NameList AND email IN : EmailList

Scenario ::
I am inserting data via dataloader with below details.
Name 1   xxx@yyy.com
Name 2   sss@rrr.com
Name 3   fff@uuu.com

I am trying to check in system on account object before insert whether any account record exists with the name and email combination.
Let me know whether two IN parameters as list in where clause will look for the data in the combination i gave ?
Ex :: Name 1 with only xxx@yyy.com and not with sss@rrr.com & fff@uuu.com

Thanks
Shailendra Singh ParmarShailendra Singh Parmar
Hi ,
It will not check combination instead it will give you result where Name match with any of provided list and email match with any of provided list. You need to then loop throw matched records and do comparision again in apex. You still need to query records so you got matching records but for one and one matching you need to have apex code.

Thanks!
Vasani ParthVasani Parth
This will perfectly work . Here's a small example 
SELECT Id,Name,Rating FROM Account where name IN ('Edge Communications','GenePoint') AND Rating in ('Hot','Warm','Cold')
Please mark this as the best answer if this helps