I'm working on creating Google Charts from MySQL datasource. This works fine so far. Now I want to count how many blocks of a Blockchain processed per hour.
How can I simple substract the first row from last row of a group?
SELECT
date_format(time,'%Y-%m-%d %H-%i'),blocks,
count(1)
FROM blockchain
GROUP BY 1
ORDER BY `date_format(time,'%Y-%m-%d %H-%i')` ASC
And if this done, how to repeat this for the last 24 hours?
Sample data:
id time blocks
3 2020-12-30 11:21:53 112149
4 2020-12-30 11:21:55 112150
5 2020-12-30 11:21:56 112150
6 2020-12-30 11:21:57 112150
7 2020-12-30 11:24:01 112169
8 2020-12-30 11:25:01 112178
9 2020-12-30 11:26:01 112188
10 2020-12-30 11:27:01 112197
-10 2020-12-30 11:27:01 112197
3 2020-12-30 11:21:53 112149
-----------------------------------------------
48
I hope its not a stupid question. I'm kinda new to this.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…