influxdata / docs-v2

InfluxData Documentation that covers InfluxDB Cloud, InfluxDB OSS 2.x, InfluxDB OSS 1.x, InfluxDB Enterprise, Telegraf, Chronograf, Kapacitor, and Flux.
https://docs.influxdata.com
MIT License
69 stars 258 forks source link

Document multi-row SQL operations with OVER #5499

Open sanderson opened 2 weeks ago

sanderson commented 2 weeks ago

SQL supports the OVER clause that allows you to perform operations involving multiple rows. For example, you can do things like moving averages:

SELECT *,
  avg(temp) OVER(ORDER BY time
     ROWS BETWEEN 2 PRECEDING AND CURRENT ROW )
     as moving_average
FROM home
WHERE room = 'Kitchen'
Relevant URLs