+ Start a Discussion
masthan khanmasthan khan 

string query='select id, rating,active__c from account where active__c=' '/';

I am trying write a query 
string query='select id, rating,active__c from account where active__c=' '/';
but it is showing an error 
Extra ';', at '/'.
 
Shruti SShruti S
What exactly are you trying to check in the Active__c field ? Are you trying to find records where the Active__c field has a single-quote in it ?
SELECT Id, Name FROM Contact WHERE Name = '\'Some Value\''
masthan khanmasthan khan
Hai Shruti,
                     i am trying find the records which are having  null value in feild active__c=' '. 
thanks
Shruti SShruti S
Please use the below SOQL query :
SELECT Id, Rating__c, Active__c FROM Account WHERE Active__c= NULL
Mohd  RaisMohd Rais
Hi Masthan,
Please try this.
String s ='';
String query = ('Select id, rating,active__c from account where active__c=\'' + s+'\'');
List<sObject> obj = database.query(query);
System.debug('Your object field list--->'+obj);

You can also use this.

String query = ('Select id, rating,active__c from account where active__c= Null');
List<sObject> obj = database.query(query);
System.debug('Your object field list--->'+obj);
Please mark it as best Answer if you find it helpful.
hank You
Mohd Rais