You need to sign in to do that
Don't have an account?
Ganesh Mate
Self join on same object
Hi folks,
I'm trying to have self join on same object in SOQL Query,but did'nt work around.
I tried different queries like ,
1) SELECT Id,Name,Type
FROM Account where Id = 'a0X3600000ACDiQEAX' IN (SELECT Type FROM Account)
2) SELECT (SELECT Type FROM Account),Id,Name,Type
FROM Account where Id = 'a0X3600000ACDiQEAX'
Thank You.
I'm trying to have self join on same object in SOQL Query,but did'nt work around.
I tried different queries like ,
1) SELECT Id,Name,Type
FROM Account where Id = 'a0X3600000ACDiQEAX' IN (SELECT Type FROM Account)
2) SELECT (SELECT Type FROM Account),Id,Name,Type
FROM Account where Id = 'a0X3600000ACDiQEAX'
Thank You.
SOQL: You cannot query on the same object in a subquery as in the main query. You can write such self semi-join querieswithout using semi-joins or anti-joins. For example, the following self semi-join query is invalid:
https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_select_comparisonoperators.htm
You want to find all the accounts having the same type as the account with the Id = 'a0X3600000ACDiQEAX' ?
Thanks for your reply.
Acutally may query is giving this output.
But i want it in this way,
Thank you.
Given your example, it is a rollup.
You should explain clearly your need for the result of the request because if you don't understand the result of the ROLLUP that is useless for you.
Open a new question now because no one else will read your question here now.
Your question was about a self join on same object in SOQL (SOLVED now)
Don't repost your initial queries for the new question because they are completely wrong (non sense).