title image


Smiley Re: Pivot-Tabelle - kumulierte Summe
Hallo,



wie schaut's aus mit:



select

p.Year,

(select sum(Amount) from Pivot where Quarter=1 and Year = p.Year) as Q1,

(select sum(Amount) from Pivot where Quarter=2 and Year = p.Year) as Q2,

(select sum(Amount) from Pivot where Quarter=3 and Year = p.Year) as Q3,

(select sum(Amount) from Pivot where Quarter=4 and Year = p.Year) as Q4,

(select sum(Amount) from Pivot where Quarter=1 and Year <= p.Year) as S1,

(select sum(Amount) from Pivot where Quarter=2 and Year <= p.Year) as S2,

(select sum(Amount) from Pivot where Quarter=3 and Year <= p.Year) as S3,

(select sum(Amount) from Pivot where Quarter=4 and Year <= p.Year) as S4

FROM Pivot as p

GROUP BY p.Year



Gruß K.K

geschrieben von

Login

E-Mail:
  

Passwort:
  

Beitrag anfügen

Symbol:
 
 
 
 
 
 
 
 
 
 
 
 
 

Überschrift: