|
create table t4 (i int);
|
insert into t4 values (1),(2);
|
select i, sum(i) over (partition by i) from t4;
|
|
Actual result
|
+------+------------------------------+
|
| i | sum(i) over (partition by i) |
|
+------+------------------------------+
|
| 1 | 3 |
|
| 2 | 2 |
|
+------+------------------------------+
|
2 rows in set (0.00 sec)
|
|
Expected result
|
postgres=# select i, sum(i) over (partition by i) from t4;
|
i | sum
|
---+-----
|
1 | 1
|
2 | 2
|
(2 rows)
|
If I add ORDER BY, the result becomes correct:
MariaDB [test]> select i, sum(i) over (partition by i order by i) from t4;
|
+------+-----------------------------------------+
|
| i | sum(i) over (partition by i order by i) |
|
+------+-----------------------------------------+
|
| 1 | 1 |
|
| 2 | 2 |
|
+------+-----------------------------------------+
|
2 rows in set (0.00 sec)
|
|