I have the following object structure
Store (parent) : Investment (child) Site : Impact (junction object) : Store
I'm trying to construct a query to display the results in a pageblocktable. The results need to be filtered to only show records where there is an impact and to show only the last investment for that store.
Ive currently come up with the following query:
[Select s.Name, (Select Name, ActualImpactCash__c, Actual_Impact__c, ForecastImpact__c, Forecast_Impact__c, Site__c From Pipeline_Impacts1__r), (Select InvestmentType__c, Investment_Date__c, actualReLaunchDate__c, Investment_Type__c, Launch_Date__c From Investment_Programs__r order by Investment_date__c desc limit 1) From Store__c s]
The problem i'm having is excluding those stores that dont have an impact associated. Any ideas?