I am having a query like this
SELECT Id, (select Id, Staff__c from Application_Contacts__r)
FROM Application__c
WHERE Id IN (SELECT Application__c
FROM License__c
WHERE Id IN (SELECT License__c
FROM monitoring__c
WHERE id in :objMonitoring))
When I run this I am getting error like this
Nesting of semi join sub-selects is not supported
So I splitted the above query into two queries and its working fine
List<License__c> lstLic=[Select Application__c from License__c where id in(select License__c from monitoring__c where id in :objMonitoring)];
Set<ID> osetAppID=new Set<ID>();
for (License__c oLic : lstLic) {
osetAppID.add(oLic.Application__c);
lstApp=[Select Id,(select Id,Staff__c from Application_Contacts__r) from Application__c where id in : osetAppID];
Is there a way to achieve it in single query.
monitoring__c is having looking up to License__c
and License__c is having look up to Application__c