0

您是否知道如何将以下 SOQL 语句组合成一个我尝试了几个选项并通过创建两个条目我能够让它工作。做正确的事我知道过多的 Select 语句可能会导致系统出现问题..!谢谢你的帮助 !!

    return [select Id, OpportunityId from OpportunityLineItem
            where OpportunityId =:opportunityId  
            and CARE_BMI_Sync_Behaviour__c = 'Sync ON'];        
    return [select Id, OpportunityId from OpportunityLineItem
            where OpportunityId =:opportunityId  
            and HasQuantitySchedule = False AND HasRevenueSchedule = False];
4

1 回答 1

1

如果您想返回这两个单独查询将返回的行,那么您需要 OR 不同的部分,例如

return [select Id, OpportunityId from OpportunityLineItem
        where OpportunityId =:opportunityId AND
        (( CARE_BMI_Sync_Behaviour__c = 'Sync ON') OR
         ( HasQuantitySchedule = False AND HasRevenueSchedule = False)) ];
于 2013-05-16T16:30:59.337 回答