You need to sign in to do that
Don't have an account?

This works in Query Editor but not Execute Anonymous
Hello friends,
This query returns results when I run it developer console's Query Editor and the Workbench's Query Editor.
This query returns results when I run it developer console's Query Editor and the Workbench's Query Editor.
select Id, Name, Campaign_Name__c, RecordType.Name from Campaign__c where Campaign_Name__c LIKE '%\_%'
However, when I try to use it in Execute Anonymous it returns nothing. I've also tried using // instead of / .
Has anybody else run into this?
Try as below,this would work.
String query ='SELECT Id, Name, Campaign_Name__c, RecordType.Name from Campaign__c where Campaign_Name__c LIKE \'%\\_%\'';
List<Campaign__c> details = Database.query(query);
system.debug('Details--'+details);
Thanks,
All Answers
Try out this
SELECT Name,id FROM Account WHERE Name LIKE 'fa%'
The following query matches farsana,faisal,fathima not feona and in LIKE statement you can pass only a single word or matching char like 'fa'
Thanks
Athira.P.U
Please store the result of SOQL query in List <Campaign__c>.
Try priniting it out using debug log, you will able ot see the result.
Hope that helps!
Try as below,this would work.
String query ='SELECT Id, Name, Campaign_Name__c, RecordType.Name from Campaign__c where Campaign_Name__c LIKE \'%\\_%\'';
List<Campaign__c> details = Database.query(query);
system.debug('Details--'+details);
Thanks,