2

This syntax works ok for using like with collection :

Set<String> setAccNames = new Set<String>();
setAccNames.add('ABC');
setAccNames.add('XYZ');
setAccNames.add('RST');
List<Account> accList = [SELECT Id FROM Account WHERE Name IN :setAccNames];

Also this syntax works with the IN operator :

SELECT Id FROM Lead WHERE Email IN ('ab.com', 'mo5stjessica@gmail.com' );

But unfortunately this is not working :

SELECT Id FROM Lead WHERE Email **LIKE** ('ab.com', 'mo5stjessica@gmail.com' );

I got Error : 'Unknown error parsing query'

Any idea ? I must do the query like that because it's dynamic.

hcohen
  • 325
  • 6
  • 17

1 Answers1

1

Remove semicolon(;) from the end of the query.
Run the below query:

SELECT Id FROM Lead WHERE Email IN ('ab.com', 'mo5stjessica@gmail.com')
Ali Azam
  • 2,047
  • 1
  • 16
  • 25