You need to sign in to do that
Don't have an account?

How get the parent ids which are does not having childs
hi,
how to get the parent object ids which are does not having the childs. I am having child records morethan 100000.
I have wrote the query like this.
for(store__C str:[select id,retail_brand__C from store__C where retail_brand__C=:rid1])
strset.add(str.id);
for(StoreProduct_category__C s1:[select id,store__C from StoreProduct_category__C where store__c in : strset limit 50000])
stset.add(s1.store__C);
for(store__C st:[select id from store__c where id not in: stset and retail_brand__c=:rid1 limit 50000])
{
system.debug(st);
stlist1.add(st);
}
I am getting the error as 'Too many 50000 query rows' error. How can i get the store ids which are does not having the store product categories. Please help me.
Thanks
Try something like this:
select id, retail_brand__C
from store__C
where id NOT IN ( select store__c from StoreProduct_category__C)
and retail_brand__c=:rid1
All Answers
Try something like this:
select id, retail_brand__C
from store__C
where id NOT IN ( select store__c from StoreProduct_category__C)
and retail_brand__c=:rid1
Hi,
Thanks for your reply its working fine.
And i have another issue. How to get the id from child object if we have morethan 50000 record.
for(store__C s1:[select id from store__C where id not in :stset and retail_brand__c in :rset])
{
storeset.add(s1.id);
}
for(storeproduct_category__c spc1:[select id,product_category__c,store__c from storeproduct_category__C where store__c in: storeset])
pset.add(spc1.product_category__c);
I need to add the set of ids in to set which a=under storeset, if the store product categories are morethan 50000. Please help me.
Thanks