Search code examples
pythonsqlmariadbwindow-functions

OVER ( ORDER BY ) issues


I would like to write a query to have a cumulative sum and then doing a graph. But the fact is that the code below is not working well, and I don't know why, i couldn't see any syntax error.

Thanks for any answer provided.

SELECT
  Datetimedeb,
  Sum(price) OVER (ORDER BY r.idR) as cumul 

FROM res r JOIN activity a ON r.idB=a.idB 

WHERE r.idB='2' AND Datetimedeb > '2010-03-01'

Solution

  • As you said your version of mariadb is 5.5.60. From version 10.2.0 SUM() can be used as a window function.