以下查询会在帐户上提取结果,并对子对象 Monthly_cc__c 和 Yearly_cc__c 使用两个内部查询。我想按 monthly_cc__c 的处理日期对结果进行排序。请帮忙
Select id,
(SELECT Country__c, Current_Month_Active__c,
Distributor__c,Personal_CC_MTD__c, Total_CC_MTD__c,
Processing_Date__c, Total_Active_CC_MTD__c,
Non_Manager_CC_MTD__c,Leadership_CC_MTD__c, Processing_Month__c,
Processing_Year__c, Global_Case_Credits__c,
Eagle_Manager_Global_New_CC__c, Chairmans_Bonus_Global_New_CC__c
FROM Account.Monthly_CCs__r
WHERE Processing_Month__c IN ( 9,8,7) AND Op_Company__c = 'GBR' ),
(SELECT Total_CC_YTD__c, Total_Active_CC_YTD__c, Non_Manager_CC_YTD__c,
Leadership_Qualification_CC_YTD__c,Operating_Company__c
FROM Account.Yearly_CCs__r
WHERE Operating_Company__c= 'GBR' AND Processing_Date__c =2016-01-01)
From Account where ID IN
('001d000001VpPcyAAF','001d000001liZH4AAM','001d000001Q5sflAAB' )
答案 0 :(得分:0)
根据您要在SUB查询中排序的事实,您有两个选择:
Account__r.Monthly_CC__c
的字段创建公式字段,然后只需使用新公式字段添加ORDER BY
SOQL子句ORDER BY
Account__r.Monthly_CC__c
SOQL子句
醇>