My query:
select (sum( c20 ))as total , año
FROM(
select distinct datepart(year,DATEADD(DAY,CONVERT(FLOAT(10),KDUD.C16),A1.C7))as año, (a1.c20) as c20
from
KDUE A1
LEFT JOIN KDMM ON KDMM.C1='U' AND A1.C3=KDMM.C2 AND A1.C4=KDMM.C3 AND A1.C5=KDMM.C4
LEFT JOIN KDMS ON A1.C1=KDMS.C1
LEFT JOIN KDUD ON A1.C2=KDUD.C2
LEFT JOIN KDUV ON A1.C18=KDUV.C2
where a1.c20 != 0) as aas
group by año
this gives this table as a result:
total año
--------------------------------------- -----------
409782.45 2013
2442993.24 2014
10810460.01 2015
but i wish i could get the years as headers and the totals as a single row... help :c