Hello !
i'm curently having issues to build a particular graph :
First, i have a database (moves) which contains 2 columns (timestamp DATETIME, dist NUMERIC), i have no problems to display a graph with these values (even using a time range such 'now','-1 hours', etc.).
But i'd like to build a graph with for example a 2 hours range which gonna display the sum of the value 'dist' every 30 seconds. So for example, if i have 2 'dist' values (3 and 4) at 0min 30sec, the graph will display 7 and the next value will be the sum of the next 30 secondes dist values.
I tried this :
curs.execute("SELECT timestamp,SUM(dist) AS dist30 FROM moves WHERE timestamp>datetime('now','-30secondes')"
curs.execute("SELECT timestamp,dist30 FROM moves WHERE timestamp>datetime('now','-1 hours')"
But it looks like the column dist30 is not created, and i think this is not gonna work if i want to change the 1 hour range...
I would like a better "algorythme", the table is filled in an other program, should i directly create a 3 columns table and SUM the dist in dist30 directly ?
Thanks for your advice !
i'm curently having issues to build a particular graph :
First, i have a database (moves) which contains 2 columns (timestamp DATETIME, dist NUMERIC), i have no problems to display a graph with these values (even using a time range such 'now','-1 hours', etc.).
But i'd like to build a graph with for example a 2 hours range which gonna display the sum of the value 'dist' every 30 seconds. So for example, if i have 2 'dist' values (3 and 4) at 0min 30sec, the graph will display 7 and the next value will be the sum of the next 30 secondes dist values.
I tried this :
curs.execute("SELECT timestamp,SUM(dist) AS dist30 FROM moves WHERE timestamp>datetime('now','-30secondes')"
curs.execute("SELECT timestamp,dist30 FROM moves WHERE timestamp>datetime('now','-1 hours')"
But it looks like the column dist30 is not created, and i think this is not gonna work if i want to change the 1 hour range...
I would like a better "algorythme", the table is filled in an other program, should i directly create a 3 columns table and SUM the dist in dist30 directly ?
Thanks for your advice !