selectField
public Query selectField(String field)
Select a specific field.
field: API name of the field. Can also be a field of a parent, e.g. 'Owner.Name'.
Query query =
new Query('Account').
selectField('Name').
selectField('Owner.Name');
public Query selectField(Schema.SObjectField field)
Select a specific field.
field: A Schema.SObjectField.
Query query =
new Query(Account.getSObjectType()).
selectField(Account.Name).
selectField(Account.OwnerId);
public Query selectField(String field, String alias)
Select a specific field and set an alias to it.
This method is only available when using aggregate functions.
field: API name of the field. Can also be a field of a parent, e.g. 'Owner.Name'.
alias: Name of the alias.
Query query =
new Query('Account').
selectField('Name', 'myName').
groupBy('Name');
public Query selectField(Schema.SObjectField field, String alias)
Select a specific field and set an alias to it.
This method is only available when using aggregate functions.
field: A Schema.SObjectField.
alias: Name of the alias.
Query query =
new Query(Account.getSObjectType()).
selectField(Account.Name, 'myName').
groupBy('Name');