function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

how to eliminate records that doesn't have children in SOQL parent to child relationship

Hi i try to eliminate records that doesn't have children in this query :


[SELECT Id , (SELECT id FROM ActivityHistories) FROM Lead


By the way i tried to make inner join between leads and ActivityHistory but the system give me that you can't make inner join between these two objects.





with out any relationship directly delete the records in particular object

 for exp: list<object>obj=[select id,name from account ];

delete obj;

with in relation ship :

for exp:list<object>obi=[select  id,(select id,name from object1) from object];

delect obj;




Thank you for reply , but i need to eliminate the records from the result only i mean to "filter the records" not to delete it.