You need to sign in to do that
Don't have an account?
Luis Guilherme Marques Lino
I'm facing some trouble to GROUP BY a SELECT with 2 Child Objects. This is the following SELECT:
The BI_BR_Atendimento_Comercial_e_Carteira__c Object repeats N times for the same BI_BR_Adabas__c for each BI_BR_Cliente__c and as I only need one record (all data will repeat N times because they are the same datas in multiple records)
To achieve this I'm trying to GROUP BY EACH Adabas on EACH Account(BI_BR_Cliente__c).
I'm getting the following error:
Group By Child Objects
I'm facing some trouble to GROUP BY a SELECT with 2 Child Objects. This is the following SELECT:
[SELECT Id AtendId, BI_BR_Adabas__c, BI_BR_Adabas__r.BI_BR_Parceiro__c, BI_BR_Cliente__c, BI_BR_Adabas__r.Modelo_de_Atuacao__c, BI_BR_Adabas__r.BI_BR_Parceiro__r.Name, BI_BR_Adabas__r.BI_BR_Parceiro__r.BI_No_Identificador_fiscal__c, BI_BR_Escopo_de_Produto__c, BI_BR_Adabas__r.BI_BR_Parceiro__r.BI_CAM_Codigo_del_cliente__c, BI_BR_Adabas__r.BI_BR_Parceiro__r.Codigo_Grupo__c, BI_BR_Adabas__r.Name AdabasName FROM BI_BR_Atendimento_Comercial_e_Carteira__c WHERE BI_BR_Cliente__c = :lCliente AND BI_BR_Adabas__r.BI_BR_Parceiro__c != null AND BI_BR_Excluir__c = false AND BI_BR_Adabas__r.Modelo_de_Atuacao__c = :lMod GROUP BY BI_BR_Adabas__c, BI_BR_Cliente__c]
The BI_BR_Atendimento_Comercial_e_Carteira__c Object repeats N times for the same BI_BR_Adabas__c for each BI_BR_Cliente__c and as I only need one record (all data will repeat N times because they are the same datas in multiple records)
To achieve this I'm trying to GROUP BY EACH Adabas on EACH Account(BI_BR_Cliente__c).
I'm getting the following error:
Line: 1, Column: 14 Field must be grouped or aggregated: Id
All Answers
You didn't add any field with aggregate function like count, sum, min, or max. Example below
Thanks,
Gaurav
Here's an example of the scenario that I have and the one I want:
Actual:
Scenario Expected: