# How shall I query different values between special time range in a measurement?

**URL:** <https://community.grafana.com/t/how-shall-i-query-different-values-between-special-time-range-in-a-measurement/51641>\
**Category:** Configuration\
**Created:** [August 10, 2021, 4:51am UTC](https://community.grafana.com/t/how-shall-i-query-different-values-between-special-time-range-in-a-measurement/51641 "2021-08-10T04:51:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![south\_wind](https://avatars.discourse-cdn.com/v4/letter/s/76d3ee/32.png) [@south\_wind](https://community.grafana.com/u/south_wind)\
**Post date:** [August 10, 2021, 4:51am UTC](https://community.grafana.com/t/how-shall-i-query-different-values-between-special-time-range-in-a-measurement/51641/1 "2021-08-10T04:51:33Z")

</div>

I have a measurement, named “A” in influxdb, now I want to show the different values between 5 hours; for example, vlaues is [0, 4, 5, 6, 4, 3, 5, 6], time is [‘20210810 00:00:00’, ‘20210810 01:00:00’, ‘20210810 02:00:00’, ‘20210810 03:00:00’, ‘20210810 04:00:00’, ‘20210810 05:00:00’, ‘20210810 06:00:00’, ‘20210810 07:00:00’,]；I want to show difference values between 2 hours: [5-0, 6-4, 4-5, 3-6, 5-4, 6-3]。so how write query sql?

---

<div class="post-metadata">

**Author:** ![grant2](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/grant2/32/42281_2.png) [@grant2](https://community.grafana.com/u/grant2)\
**Post date:** [August 11, 2021, 2:16am UTC](https://community.grafana.com/t/how-shall-i-query-different-values-between-special-time-range-in-a-measurement/51641/2 "2021-08-11T02:16:27Z")

</div>

How about a transformation that uses a Binary operation to calculate the difference?

 ![image](https://us1.discourse-cdn.com/grafana/original/3X/e/5/e51c12de949b9ad7ecd3b459c418f5f1c2995e5d.png)
