+ Start a Discussion

Subquery using parent values



Am trying to fetch records where child name same as parent name. For ex:


Select Name , ( select Name from Child__r where Name =: Parent__c.Name ) from parent__C ; This query is not working


How can i write  query like this?


You can't check like this with field values after operator in the same query. For this you have to write another query based on the value of this query,


If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.



Select Name , ( select Name from Child__r  As C ) from parent__C As P Where C.Name Is In :P.Name