cezium | Code :
- SELECT employe, Date,
- sum(case ID_Cpt when 9 then value when 12 then value else 0 end) as cpt1
- sum(case ID_Cpt when 10 then value else 0 end) as cpt2
- sum(case ID_Cpt when 11 then value else 0 end) as cpt3
- sum(case ID_Cpt when 7 then value else 0 end) as cpt4
- sum(case ID_Cpt when 51 then value else 0 end) as cpt5
- sum(case ID_Cpt when 46 then value else 0 end) as cpt6
- sum(case ID_Cpt when 14 then value else 0 end) as cpt7
- sum(case ID_Cpt when 47 then value else 0 end) as cpt8
- sum(case ID_Cpt when 53 then value else 0 end) as cpt9
- sum(case ID_Cpt when 16 then value else 0 end) as cpt10
- FROM StatCalc
- WHERE employe In (1,248)
- group by Employe,Date
| Comme çà ? Edit : Apparemment Access ne connait pas le "case when" (no comment), il faut donc remplacer par des IIF(expression,vrai,faux) Donc comme çà :
Code :
- SELECT employe, Date,
- sum(IIF(ID_Cpt=9,value,IIF(ID_Cpt=12,value,0))) as cpt1
- sum(IIF(ID_Cpt=10,value,0)) as cpt2
- sum(IIF(ID_Cpt=11,value,0)) as cpt3
- sum(IIF(ID_Cpt=7,value,0)) as cpt4
- sum(IIF(ID_Cpt=51,value,0)) as cpt5
- sum(IIF(ID_Cpt=46,value,0)) as cpt6
- sum(IIF(ID_Cpt=14,value,0)) as cpt7
- sum(IIF(ID_Cpt=47,value,0)) as cpt8
- sum(IIF(ID_Cpt=53,value,0)) as cpt9
- sum(IIF(ID_Cpt=16,value,0)) as cpt10
- FROM StatCalc
- WHERE employe In (1,248)
- group by Employe,Date
| Je n'ai pas testé, je n'ai pas de base Access sous la main (et je n'en veux pas ) Message édité par cezium le 15-09-2009 à 14:06:36
|