(Gast)
n/a Beiträge
|
Re: Kreuztabelle - kein Detail- aber SUM Wert
24. Okt 2008, 15:07
Hallo,
meinst Du sowas?
SQL-Code:
select Monat, IsNull(Wert,0) As Wert from (
select IsNull(sum(IsNull(Wert,0)),0) As Wert, month(datum) as Mo from tabelle
where month(datum) in (1,2,4,5,6,9) -- das muss natürlich angepasst werden
group by month(datum)
) a
right join
(
select 1 As Mo, 'Jan' as Monat
union all
select 2, 'Feb' as Monat
union all
select 3, 'Mrz' as Monat
union all
select 4, 'Apr' as Monat
union all
select 5, 'May' as Monat
union all
select 6, 'Jun' as Monat
union all
select 7, 'Jul' as Monat
union all
select 8, 'Aug' as Monat
union all
select 9, 'Sep' as Monat
union all
select 10, 'Okt' as Monat
union all
select 11, 'Nov' as Monat
union all
select 12, 'Dez' as Monat
) b
on a.Mo = b.Mo
|
|
Zitat
|