Bonjour, voici 1 requete un peu alambiquée que je n'arrive pas à valider.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
 
select idf_agent,
sum(bul.bas_rub)    BASE_OUVR ,
substr(bul.cod_rub,1,3) cod,
(select sum(bul2.bas_rub) from rh.bulpai_anter bul2 , rh.vue_charges vue
where bul2.idf_agent = bul.idf_agent
and bul2.cod_rub = vue.cod_rub
and vue.typ_cotis ='IRC'
and ind_cotis ='P'
and substr(bul2.cod_rub,1,3) = ( substr(bul.cod_rub,1,3) + '1' )
) somme
from rh.bulpai_anter bul, rh.vue_charges vue
where bul.idf_agent = 17093
and bul.cod_rub = vue.cod_rub
and vue.typ_cotis ='IRC'
and ind_cotis ='O'
and mnt_rub <> 0
group by bul.idf_agent ,substr(bul.cod_rub,1,3)
L'agent 17093 contiend dans la table bul 8 lignes avec pour identifiant 840C(A),842C(A) et leur pendant 841C(A) et 843C(A). Je souhaiterais afficher sur 2 ligne les infos suivantes :
idf_agent,somme_base_rubrique_840%,somme_base_rubrique_841%
idf_agent,somme_base_rubrique_842%,somme_base_rubrique_843%

Mais l'exécution plante en disant que cette ligne
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
 
and substr(bul2.cod_rub,1,3) = ( substr(bul.cod_rub,1,3) + '1' )
n'est pas 1 expression group by, qui aurait 1 idée