Is there any use for defining additional entity types in a SOQL FROM clause?query user and profileSOQL relationship name syntax errorDynamic SOQL bindingWhat is wrong with my relationship?How to query all records changed since date?SOQL for Lookup relationshipLeft join in Bulk APISelect where not exists / count(otherRecord) = 0How can we Get the records of contacts where phone= account.phone?What types of fields are groupable in a SOQL `GROUP BY` clause?SOQL Search function of Contact Name With Account Parent to Contact Child
Is ipsum/ipsa/ipse a third person pronoun, or can it serve other functions?
Email Account under attack (really) - anything I can do?
How to make particles emit from certain parts of a 3D object?
Is it wise to focus on putting odd beats on left when playing double bass drums?
Are white and non-white police officers equally likely to kill black suspects?
Landlord wants to switch my lease to a "Land contract" to "get back at the city"
What is it called when one voice type sings a 'solo'?
Was there ever an axiom rendered a theorem?
Is domain driven design an anti-SQL pattern?
What happens when a metallic dragon and a chromatic dragon mate?
Does a dangling wire really electrocute me if I'm standing in water?
Denied boarding due to overcrowding, Sparpreis ticket. What are my rights?
aging parents with no investments
How could a lack of term limits lead to a "dictatorship?"
How can I fix this gap between bookcases I made?
Why do UK politicians seemingly ignore opinion polls on Brexit?
How can I plot a Farey diagram?
Can a planet have a different gravitational pull depending on its location in orbit around its sun?
Can I find out the caloric content of bread by dehydrating it?
Is it legal to have the "// (c) 2019 John Smith" header in all files when there are hundreds of contributors?
Where to refill my bottle in India?
How to answer pointed "are you quitting" questioning when I don't want them to suspect
How to make payment on the internet without leaving a money trail?
Does the average primeness of natural numbers tend to zero?
Is there any use for defining additional entity types in a SOQL FROM clause?
query user and profileSOQL relationship name syntax errorDynamic SOQL bindingWhat is wrong with my relationship?How to query all records changed since date?SOQL for Lookup relationshipLeft join in Bulk APISelect where not exists / count(otherRecord) = 0How can we Get the records of contacts where phone= account.phone?What types of fields are groupable in a SOQL `GROUP BY` clause?SOQL Search function of Contact Name With Account Parent to Contact Child
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
Here's a somewhat odd SOQL query from the question query user and profile:
select user.id, user.Email,user.FirstName,user.LastName,user.profile.name,user.Username,user.IsActive
from user, user.profile
Note that the FROM
clause includes both user
and user.profile
.
Here is a simpler example to follow the Contact to Account relationship:
select Id, Name, Account.Name from Contact, Contact.Account
The same query with the relationship join can be performed with:
Select Id, Name, Account.Name From Contact
Is there any purpose to supporting additional SObject types in the from clause, or is it vestigial?
Is is outlined as supported syntax in SOQL.
SELECT fieldList [subquery][...]
[TYPEOF typeOfField whenExpression[...] elseExpression END][...]
FROM objectType[,...]
[USING SCOPE filterScope]
Out of interest, if you don't use a valid sObject relationship on the additional sObject types you get the following message:
INVALID_TYPE:
Name, Account.Name From Contact, Account
^
ERROR at Row:1:Column:45
A driving SObject type has already been set, all other entity types in the FROM clause must
be relationships to the initial object. The driving object is Contact.
While doing some checking I found this old dev forum question that indicated it was added to the syntax in Winter '15. Or at least documented then. - Missing doc for new SOQL multiple object SELECT?
soql
add a comment |
Here's a somewhat odd SOQL query from the question query user and profile:
select user.id, user.Email,user.FirstName,user.LastName,user.profile.name,user.Username,user.IsActive
from user, user.profile
Note that the FROM
clause includes both user
and user.profile
.
Here is a simpler example to follow the Contact to Account relationship:
select Id, Name, Account.Name from Contact, Contact.Account
The same query with the relationship join can be performed with:
Select Id, Name, Account.Name From Contact
Is there any purpose to supporting additional SObject types in the from clause, or is it vestigial?
Is is outlined as supported syntax in SOQL.
SELECT fieldList [subquery][...]
[TYPEOF typeOfField whenExpression[...] elseExpression END][...]
FROM objectType[,...]
[USING SCOPE filterScope]
Out of interest, if you don't use a valid sObject relationship on the additional sObject types you get the following message:
INVALID_TYPE:
Name, Account.Name From Contact, Account
^
ERROR at Row:1:Column:45
A driving SObject type has already been set, all other entity types in the FROM clause must
be relationships to the initial object. The driving object is Contact.
While doing some checking I found this old dev forum question that indicated it was added to the syntax in Winter '15. Or at least documented then. - Missing doc for new SOQL multiple object SELECT?
soql
Ah, I finally know how this strange syntax can actually be used. No idea on what it actually does though. Maybe it helps with choosing indices to use, or helps disambiguate multiple references to the same related SObject?
– Derek F
2 hours ago
@DerekF Currently is seems redundant. Like it was maybe a left over from the SQL query origins. I'm still not sure what it would help disambiguate. Maybe for polymorphic relationships?
– Daniel Ballinger
2 hours ago
add a comment |
Here's a somewhat odd SOQL query from the question query user and profile:
select user.id, user.Email,user.FirstName,user.LastName,user.profile.name,user.Username,user.IsActive
from user, user.profile
Note that the FROM
clause includes both user
and user.profile
.
Here is a simpler example to follow the Contact to Account relationship:
select Id, Name, Account.Name from Contact, Contact.Account
The same query with the relationship join can be performed with:
Select Id, Name, Account.Name From Contact
Is there any purpose to supporting additional SObject types in the from clause, or is it vestigial?
Is is outlined as supported syntax in SOQL.
SELECT fieldList [subquery][...]
[TYPEOF typeOfField whenExpression[...] elseExpression END][...]
FROM objectType[,...]
[USING SCOPE filterScope]
Out of interest, if you don't use a valid sObject relationship on the additional sObject types you get the following message:
INVALID_TYPE:
Name, Account.Name From Contact, Account
^
ERROR at Row:1:Column:45
A driving SObject type has already been set, all other entity types in the FROM clause must
be relationships to the initial object. The driving object is Contact.
While doing some checking I found this old dev forum question that indicated it was added to the syntax in Winter '15. Or at least documented then. - Missing doc for new SOQL multiple object SELECT?
soql
Here's a somewhat odd SOQL query from the question query user and profile:
select user.id, user.Email,user.FirstName,user.LastName,user.profile.name,user.Username,user.IsActive
from user, user.profile
Note that the FROM
clause includes both user
and user.profile
.
Here is a simpler example to follow the Contact to Account relationship:
select Id, Name, Account.Name from Contact, Contact.Account
The same query with the relationship join can be performed with:
Select Id, Name, Account.Name From Contact
Is there any purpose to supporting additional SObject types in the from clause, or is it vestigial?
Is is outlined as supported syntax in SOQL.
SELECT fieldList [subquery][...]
[TYPEOF typeOfField whenExpression[...] elseExpression END][...]
FROM objectType[,...]
[USING SCOPE filterScope]
Out of interest, if you don't use a valid sObject relationship on the additional sObject types you get the following message:
INVALID_TYPE:
Name, Account.Name From Contact, Account
^
ERROR at Row:1:Column:45
A driving SObject type has already been set, all other entity types in the FROM clause must
be relationships to the initial object. The driving object is Contact.
While doing some checking I found this old dev forum question that indicated it was added to the syntax in Winter '15. Or at least documented then. - Missing doc for new SOQL multiple object SELECT?
soql
soql
asked 3 hours ago
Daniel BallingerDaniel Ballinger
74.4k15155406
74.4k15155406
Ah, I finally know how this strange syntax can actually be used. No idea on what it actually does though. Maybe it helps with choosing indices to use, or helps disambiguate multiple references to the same related SObject?
– Derek F
2 hours ago
@DerekF Currently is seems redundant. Like it was maybe a left over from the SQL query origins. I'm still not sure what it would help disambiguate. Maybe for polymorphic relationships?
– Daniel Ballinger
2 hours ago
add a comment |
Ah, I finally know how this strange syntax can actually be used. No idea on what it actually does though. Maybe it helps with choosing indices to use, or helps disambiguate multiple references to the same related SObject?
– Derek F
2 hours ago
@DerekF Currently is seems redundant. Like it was maybe a left over from the SQL query origins. I'm still not sure what it would help disambiguate. Maybe for polymorphic relationships?
– Daniel Ballinger
2 hours ago
Ah, I finally know how this strange syntax can actually be used. No idea on what it actually does though. Maybe it helps with choosing indices to use, or helps disambiguate multiple references to the same related SObject?
– Derek F
2 hours ago
Ah, I finally know how this strange syntax can actually be used. No idea on what it actually does though. Maybe it helps with choosing indices to use, or helps disambiguate multiple references to the same related SObject?
– Derek F
2 hours ago
@DerekF Currently is seems redundant. Like it was maybe a left over from the SQL query origins. I'm still not sure what it would help disambiguate. Maybe for polymorphic relationships?
– Daniel Ballinger
2 hours ago
@DerekF Currently is seems redundant. Like it was maybe a left over from the SQL query origins. I'm still not sure what it would help disambiguate. Maybe for polymorphic relationships?
– Daniel Ballinger
2 hours ago
add a comment |
1 Answer
1
active
oldest
votes
One possible use is to use is to combine it with the Alias notation for the related sObjects.
E.g.
select c.Id, c.Name, ca.Name, art.Name
from Contact c, Contact.Account ca, Contact.Account.RecordType art
If you wanted to query many fields from the related sObject then you could save a significant number of characters if you are running up against the 20,000 character limit.
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "459"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f257078%2fis-there-any-use-for-defining-additional-entity-types-in-a-soql-from-clause%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
One possible use is to use is to combine it with the Alias notation for the related sObjects.
E.g.
select c.Id, c.Name, ca.Name, art.Name
from Contact c, Contact.Account ca, Contact.Account.RecordType art
If you wanted to query many fields from the related sObject then you could save a significant number of characters if you are running up against the 20,000 character limit.
add a comment |
One possible use is to use is to combine it with the Alias notation for the related sObjects.
E.g.
select c.Id, c.Name, ca.Name, art.Name
from Contact c, Contact.Account ca, Contact.Account.RecordType art
If you wanted to query many fields from the related sObject then you could save a significant number of characters if you are running up against the 20,000 character limit.
add a comment |
One possible use is to use is to combine it with the Alias notation for the related sObjects.
E.g.
select c.Id, c.Name, ca.Name, art.Name
from Contact c, Contact.Account ca, Contact.Account.RecordType art
If you wanted to query many fields from the related sObject then you could save a significant number of characters if you are running up against the 20,000 character limit.
One possible use is to use is to combine it with the Alias notation for the related sObjects.
E.g.
select c.Id, c.Name, ca.Name, art.Name
from Contact c, Contact.Account ca, Contact.Account.RecordType art
If you wanted to query many fields from the related sObject then you could save a significant number of characters if you are running up against the 20,000 character limit.
answered 2 hours ago
Daniel BallingerDaniel Ballinger
74.4k15155406
74.4k15155406
add a comment |
add a comment |
Thanks for contributing an answer to Salesforce Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f257078%2fis-there-any-use-for-defining-additional-entity-types-in-a-soql-from-clause%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Ah, I finally know how this strange syntax can actually be used. No idea on what it actually does though. Maybe it helps with choosing indices to use, or helps disambiguate multiple references to the same related SObject?
– Derek F
2 hours ago
@DerekF Currently is seems redundant. Like it was maybe a left over from the SQL query origins. I'm still not sure what it would help disambiguate. Maybe for polymorphic relationships?
– Daniel Ballinger
2 hours ago