You need to sign in to do that
Don't have an account?
Wil Pho
accessing parent object using soql
Hi there,
New to writing SOQL scripts using Workbench. So there is a customer object called Affiliation (NU__Affiliation__r) that has a lookup relationship to the Account object.
SELECT Name,
NU__Account__c,
NU__ParentAccount__c
Account.Name
FROM NU__Affiliation__c
When I run the above script it's throwing the following error. I'm trying to access the parent Account fields.
MALFORMED_QUERY: only aggregate expressions use field aliasing
I also tried this script:
SELECT AccountNumber,Id,
(SELECT Name,NU__Account__c,NU__IsPrimary__c
FROM NU__Affiliation__r)
FROM Account
And I got this error:
INVALID_TYPE:
FROM NU__Affiliation__r)
^
ERROR at Row:5:Column:6
Didn't understand relationship 'NU__Affiliation__r' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names.
Would very much appreciate any help!
Regards,
Wil
New to writing SOQL scripts using Workbench. So there is a customer object called Affiliation (NU__Affiliation__r) that has a lookup relationship to the Account object.
SELECT Name,
NU__Account__c,
NU__ParentAccount__c
Account.Name
FROM NU__Affiliation__c
When I run the above script it's throwing the following error. I'm trying to access the parent Account fields.
MALFORMED_QUERY: only aggregate expressions use field aliasing
I also tried this script:
SELECT AccountNumber,Id,
(SELECT Name,NU__Account__c,NU__IsPrimary__c
FROM NU__Affiliation__r)
FROM Account
And I got this error:
INVALID_TYPE:
FROM NU__Affiliation__r)
^
ERROR at Row:5:Column:6
Didn't understand relationship 'NU__Affiliation__r' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names.
Would very much appreciate any help!
Regards,
Wil
In the first Query I think there can be two problems:
In the second query you can try below mentioned changes
Let me know if it helps of if any error occures.
Thanks,
Ayush Sharma
All Answers
In the first Query I think there can be two problems:
In the second query you can try below mentioned changes
Let me know if it helps of if any error occures.
Thanks,
Ayush Sharma
When I tried "NU__Affiliations__r" it worked!
Thank you so much!
Wil