I have the following query, which uses 2 variables, the record type ID and a list of comma separated fields.
Id schoolRecordTypeId = SchoolRecordTypeId; String fields = getFields(); //e.g. 'Name, Type, Stage__c, ' String query = 'SELECT ' + fields + ' id FROM Account WHERE RecordTypeId = :schoolRecordTypeId';
The above query works, but the below one doesn't (Note use of
Why would the above work and the below doesn't?
String query = 'SELECT :fields id FROM Account WHERE RecordTypeId = :schoolRecordTypeId';