Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

I am trying to run this query in Query Editor but got

"Unknown error parsing query"

Is there any workaround for this?

Select Customer_Name__c From SAP_Customer_Master__c where Customer_Name__c like ('trimax%','thomas%')
share|improve this question

1 Answer 1

up vote 4 down vote accepted

You can't do that with a like, you'd need to use OR instead:

Select Customer_Name__c From SAP_Customer_Master__c where Customer_Name__c like 'trimax%' or Customer_Name__c like 'thomas%'

EDIT

Something that I didn't know, that I've only just found out from trying it, is that you can use LIKE with bind variables. So, whereas the SOQL in the OP wouldn't work due to a compilation error, this would:

Set<String> names = new Set<String>{'trimax%', 'thomas%'};
List<SAP_Customer_Master__c> masters = [Select Customer_Name__c 
From SAP_Customer_Master__c 
where Customer_Name__c like :names];
share|improve this answer
    
Thanks @Phil Hawthorn. Would that be too tedious to construct a query if there is a big list of string for instance a 500? –  Baskaran S Jul 29 at 15:18
    
Agreed, that would be very tedious but only a little more tedious that typing like ('trimax%', 'thomas%'). Editing my answer. –  Phil Hawthorn Jul 29 at 15:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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