Bonjour, voici une requête qui fonctionne parfaitement :
Maintenant je souhaite ajouter une colonne qui calcule la différente entre SUM(of_pds_r) et POIDS_NET comme suis :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6 select LOT_AKA,ART_CODE,ART_LIBELLE1,LOT,POIDS_NET,UNITES, SUM(of_pds_r) POIDS_OF,SUM(of_col_r) UNITES_OF from Vw_Arrivages_002 inner join GCOF on LOT_AKA = OF_ACH_SEQ and LOT_AKA = 813087 group by LOT_AKA,ART_CODE,ART_LIBELLE1,LOT,POIDS_NET,UNITES;
Mais cela me renvoi une erreur :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6 select LOT_AKA,ART_CODE,ART_LIBELLE1,LOT,POIDS_NET,UNITES, SUM(of_pds_r) POIDS_OF,SUM(of_col_r) UNITES_OF,SUM(SUM(of_pds_r) - POIDS_NET) ECART_PDS from Vw_Arrivages_002 inner join GCOF on LOT_AKA = OF_ACH_SEQ and LOT_AKA = 813087 group by LOT_AKA,ART_CODE,ART_LIBELLE1,LOT,POIDS_NET,UNITES;
"Msg*130, Niveau*15, État*1, Ligne*20
Impossible d'exécuter une fonction d'agrégation sur une expression comportant un agrégat ou une sous-requête."
Comment puis-je corriger cette erreur ?
Merci de votre aide.
Partager