Skip to content

Instantly share code, notes, and snippets.

@fritzek
Created June 24, 2011 09:38
Show Gist options
  • Save fritzek/1044501 to your computer and use it in GitHub Desktop.
Save fritzek/1044501 to your computer and use it in GitHub Desktop.
create table ft_test (datum date, anzahl number);
insert into ft_test (datum, anzahl) values ('01.06.2011',5);
insert into ft_test (datum, anzahl) values ('02.06.2011',5);
insert into ft_test (datum, anzahl) values ('03.06.2011',5);
insert into ft_test (datum, anzahl) values ('04.06.2011',5);
select * from ft_test;
SELECT a.datum, (SELECT SUM (b.anzahl)
FROM ft_test b
WHERE b.datum BETWEEN '01.01.1900' AND a.datum) sum
FROM ft_test a;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment