I have a table called quantities:
+----------+----------+
| date | quantity |
+----------+----------+
| 30/11/17 | 90 |
+----------+----------+
| 01/12/17 | |
+----------+----------+
| 02/12/17 | |
+----------+----------+
| 03/12/17 | 1622 |
+----------+----------+
| 04/12/17 | |
+----------+----------+
| 05/12/17 | 9092 |
+----------+----------+
| 06/12/17 | |
+----------+----------+
| 07/12/17 | |
+----------+----------+
| 08/12/17 | 2132 |
+----------+----------+
| 09/12/17 | |
+----------+----------+
| 10/12/17 | 2889 |
+----------+----------+
And I want to select it so that I can fill in the blanks with the previous non-null value:
+----------+----------+
| date | quantity |
+----------+----------+
| 30/11/17 | 90 |
+----------+----------+
| 01/12/17 | 90 |
+----------+----------+
| 02/12/17 | 90 |
+----------+----------+
| 03/12/17 | 1622 |
+----------+----------+
| 04/12/17 | 1622 |
+----------+----------+
| 05/12/17 | 9092 |
+----------+----------+
| 06/12/17 | 9092 |
+----------+----------+
| 07/12/17 | 9092 |
+----------+----------+
| 08/12/17 | 2132 |
+----------+----------+
| 09/12/17 | 2132 |
+----------+----------+
| 10/12/17 | 2889 |
+----------+----------+
I am using PostgreSQL 8.0.2 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.4.2 20041017 (Red Hat 3.4.2-6.fc3), Redshift 1.0.1499
How could I achieve this?
Thanks!