You need to sign in to do that
Don't have an account?
NinoJose
Parent to child Query Dilemma
Hi All, I hope somebody can shed light on my problem using parent to child soql query. I have 2 custom objects, Object1 and Object2. Object1 is the parent of Object2. What I want to do is to query records from Object1 who dont have child records but I cannot fetch records who don't have child records. What I can only do is to query all the records from Object1 and then I manually check if it has no corresponding child records on my scontrol code.
Below is my soql query:
SELECT Object1.Id, (SELECT Object2.Id FROM Object1.RelationshipNameToObject2) FROM Object1
Now, is there any code in which I can check whether the subquery dont return any value so that I wont have to check on my javascript code if a record don't have child records?
Thanks in advice.
Below is my soql query:
SELECT Object1.Id, (SELECT Object2.Id FROM Object1.RelationshipNameToObject2) FROM Object1
Now, is there any code in which I can check whether the subquery dont return any value so that I wont have to check on my javascript code if a record don't have child records?
Thanks in advice.
How about a rollup summary field with a count of the child objects? That way, you could simply to a query for those parents where the summary field is equal to 0.
Hope this helps.