0

I have query that written something like this:

I have data for both Schulz and Scholz

List<User> usr = [SELECT Id, Name From User Where Name IN ('Schulz', 'Eric')];

The above query works fine.

My question is if someone types Scholz I want the above query to be written data as well since I have data for both Schulz and Scholz

Is there a way to add OR within the IN clause? if yes how would I do that?

The last option left is to have two(which I want to avoid) separate SOQL query one for Schulz and the other is for Scholz

2
  • Why don't you just add the third string? Name IN ('A', 'B', 'C')
    – Adrian Larson
    Oct 2, 2018 at 18:07
  • shoot you're correct, I don't know what I was thinking. thanks for pointer.
    – Nick
    Oct 2, 2018 at 18:15

1 Answer 1

1

Just add it to your IN clause:

Name IN ('Schulz', 'Eric', 'Scholz')
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .