+ Start a Discussion

Soql doesnt support field aliasing....

Its bad to find SOQL doesnt have field alias


example we cant use


select Id, First_Name__c as 'Name' from Candidate


But why would you need aliasing?



As far as i know. There are no field alias's in SOQL, only object aliases.


Not just one but for many reasons,


I want to do something like this


Select id, (First_Name__c + ' ' + Last_Name__c) 'FullName' From Candidate__c


I cant keep on adding Custom fields to the standard objects.


Just think, how difficult it is for reporting. Generally in reporting you always use column aliasing.


Any clue how we solve this. I am not able to retrieve two standard field (Name ) in single query. It throws an error as "Duplicate alias: Name". 

Roman BieleiRoman Bielei
Finally we have found decision how to "rename" column in SOQL without using standart Aggregate function that requires Group by clause in the end, and unfortunately doesn`t allow to export more that 2000 rows in query.
The best way is using Format(Field) Custom_Name. It could be tricky way to use this with some dates values or e.t.c cause function changes format of values in field.
Roman, would you mind posting an example of your solution please? I can't seem to get it to work.