0

I have to get records whose picklist value is x and y. I wrote a sqol in developer console I am not getting result. If I do separate search for x and y. I am getting result. else I am not getting any result. SELECT AccountID From Contract Where Status = 'x , y'. Is this the way to write or anything I need to change. The picklist status is no multiselect.

6

Try this:

String[] values = new String[] {'x', 'y'};
Contract[] contracts = [SELECT AccountID From Contract Where Status in :values];

Or

SELECT AccountID From Contract Where Status in ('x', 'y')

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.