function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
VijendraVijendra 

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

KalyanLKalyanL

But why would you need aliasing?

 

Teach_me_howTeach_me_how

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

VijendraVijendra

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.

HemanthrulezHemanthrulez

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.
jgood2009jgood2009
Roman, would you mind posting an example of your solution please? I can't seem to get it to work.