SELECT C.Datum,C.Kommentar,CASE WHEN C.DebetKonto= THEN P.Kontonamn WHEN C.KreditKonto= THEN R.Kontonamn END AS 'Konto',ROUND(CASE WHEN C.DebetKonto= THEN C.Debetsumma WHEN C.KreditKonto= THEN -C.Kreditsumma END,2) AS Summa,SUM(ROUND(CASE WHEN C.DebetKonto= THEN C.Debetsumma WHEN C.KreditKonto= THEN -C.Kreditsumma END,2)) OVER(ORDER BY Datum ROWS between unbounded preceding AND CURRENT ROW) AS Totalsumma FROM transaktioner AS C INNER JOIN konton AS P ON C.KreditKonto=P.Kontonummer INNER JOIN konton AS R ON C.DebetKonto=R.Kontonummer WHERE DebetKonto= OR Kreditkonto= ORDER BY Datum
No record found