+ Start a Discussion
Sandeep M 1Sandeep M 1 

Soql query on custom objects using junction object

i have three custom objects.

Bank_Account__c(Parent) --->Bank_transaction__c(child)

Bank_Account__c(Parent) --->Bank_statement__c(child)

Bank_transaction__c fields are date__c, credit__c, debit__c

Bank_statement__c fields are start_date__c, end_date__c

I just want to write a single query to get the records of Bank_transaction__c which date__c is in between start_date__c and end_date__c of bank_statement__c object. How can i achieve this

I don't think this can be achieved in a single query, as they have a many-to-many kind of a relationship. The best alternative is to write separate SOQL querues for both child objects, and use for loops to get a list of required records.

Sandeep M 1Sandeep M 1
Okay even for that how can we do that ?
marys pindamarys pinda
Shasshank_SFDC, can you help me?


Thank you!