+ Start a Discussion
abhishek_pandey1989@yahoo.comabhishek_pandey1989@yahoo.com 

Dyanmic query error

L = Database.query('SELECT Id,Name (Select QualificationStatus__c From Qualifications__r where QualificationStatus__c =\'Success\' AND QualificationType__c=:countries) FROM Contact WHERE Firstname= :text');

 

 

Getting error

System.QueryException: unexpected token: 'Select'

 

 

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
Yoganand GadekarYoganand Gadekar

 

try like this

L = Database.query('SELECT Id,Name, (Select QualificationStatus__c From Qualifications__r where QualificationStatus__c =\'Success\' AND QualificationType__c=:countries) FROM Contact WHERE Firstname= :text');

All Answers

vbsvbs
There's a comma missing after the Name column in the main select
Yoganand GadekarYoganand Gadekar

 

try like this

L = Database.query('SELECT Id,Name, (Select QualificationStatus__c From Qualifications__r where QualificationStatus__c =\'Success\' AND QualificationType__c=:countries) FROM Contact WHERE Firstname= :text');

This was selected as the best answer