Skip to content

Commit

Permalink
Aggregationsfehler behoben
Browse files Browse the repository at this point in the history
  • Loading branch information
Wolfgang Wiedermann committed Dec 30, 2015
1 parent 242e5e9 commit dd59bb3
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions sql/query/bilanz_monat_csv.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ select
format(sum(
case when b.sollkonto = b.habenkonto then 0
when k.kontonummer = b.sollkonto then b.betrag
when k.kontonummer = b.habenkonto then b.betrag * -1
when k.kontonummer = b.habenkonto then b.betrag * -1
end
), 2, 'de_DE') as saldo
from fi_buchungen as b
Expand All @@ -25,6 +25,5 @@ from fi_buchungen as b
select distinct year(bint.datum) as jahr, month(bint.datum) as monat
from fi_buchungen as bint
) as t
on year(b.datum) <= t.jahr
and month(b.datum) <= t.monat
group by t.jahr, t.monat, k.kontonummer, k.bezeichnung, k.kontenart_id
on (year(b.datum)*100)+month(b.datum) <= (t.jahr*100)+t.monat
group by t.jahr, t.monat, k.kontonummer, substr(k.kontonummer, 1, 1), k.bezeichnung, k.kontenart_id

0 comments on commit dd59bb3

Please sign in to comment.