我有一个表,其中包含以下列“值”列中的数据累积,并且数据以 15 分钟时间间隔获取
name | value | start_time |end_time |
------------------------------------------------------------
likes | 5 |2013-05-29 16:30:00 |2013-05-29 17:45:00 |
likes | 6 |2013-05-29 17:00:00 |2013-05-29 17:15:00 |
likes | 6 |2013-05-29 17:30:00 |2013-05-29 17:45:00 |
likes | 10 |2013-05-29 18:00:00 |2013-05-29 18:15:00 |
likes | 10 |2013-05-29 18:30:00 |2013-05-29 18:45:00 |
likes | 11 |2013-05-29 19:00:00 |2013-05-29 19:15:00 |
likes | 11 |2013-05-29 19:30:00 |2013-05-29 19:45:00 |
我想要每 1 小时获取一次数据的 sql 查询,并且“值”列中的数据应该是实际数据而不是累积的
例如:
name | value | start_time |end_time |
------------------------------------------------------------
likes | 1 |2013-05-29 17:00:00 |2013-05-29 17:59:00 |
或者
name | value | start_time |end_time |
------------------------------------------------------------
likes | 1 |2013-05-29 17:00:00 |2013-05-29 17:15:00 |
likes | 0 |2013-05-29 17:30:00 |2013-05-29 17:45:00 |
我希望“价值”列数据作为该时期的实际数据而不是累积数据