I have a requirement, for each Accountwhose name contains ‘Sale’, ‘Opportunity’, or ‘Catalog’, set Price_Type__c to ‘Net’.
This is what I code in Anonymous Apex:
set<string> myString = new Set<String>{'%Sale%', '%Opportunity%', '%Catalog%'};
List<Pricebook2> myList = [select Name from Pricebook2 where name LIKE IN: myString];
for (Pricebook2 rec : myList) {
rec.Is_Auto_Maintained__c = true;
rec.Price_Type__c ='Net;'
}
update myList;
and it threw an error : "
expecting a colon, found 'IN'
". So is there any other solution to this?