65

Is there a way to mix LIKE operator with IN ? Something Like

SELECT Id FROM Account WHERE Name LIKE IN:nameList

Where nameList is list of String? Is this is possible ? (I can make a dynamic query by doing OR with all the elements, but was looking for a more elegant way to do this)

Avidev9
  • 5,649
  • 4
  • 36
  • 50

1 Answers1

97

No, but you can query like this which does the same thing as what you're trying to do:

String[] filters = new String[]{'acme%','ib%'};
List<Accounts> accs = [SELECT Id, Name FROM Account WHERE Name LIKE :filters];
fred
  • 3,335
  • 3
  • 16
  • 27
drakored
  • 2,698
  • 15
  • 17