salesforce - Complex SOQL query for parent/child records -


i'm trying figure out efficient way build query. have "category" object , in category object there "parent_category__c" field. category product (and there "product_category__c" junction object links categories products.) product can have multiple levels of parent categories.

product -> product_category__c -> category <--|                                       |_______|  

the way system (which inherited) built causing me start bottom-up. have find product first, find product_category__c, , find categories__c. lowest level child category. efficient way query way root category -- keeping in mind have few thousand times each product.

i had thought querying categories , storing them in map reference don't know how many categories client have. large.

thanks help.

decided go recursive route...


Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -