docs-v2/content/influxdb3/core/query-data/sql/aggregate-select.md

1.0 KiB

title description menu weight influxdb3/core/tags related list_code_example source
Aggregate data with SQL Use aggregate and selector functions to perform aggregate operations on your time series data.
influxdb3_core
name parent identifier
Aggregate data Query with SQL query-sql-aggregate
203
query
sql
/influxdb3/core/reference/sql/functions/aggregate/
/influxdb3/core/reference/sql/functions/selector/
/influxdb3/core/reference/sql/group-by/
##### Aggregate fields by groups ```sql SELECT mean(field1) AS mean, selector_first(field2)['value'] as first, tag1 FROM home GROUP BY tag ``` ##### Aggregate by time-based intervals ```sql SELECT DATE_BIN(INTERVAL '1 hour', time, '2022-01-01T00:00:00Z'::TIMESTAMP) AS time, mean(field1), sum(field2), tag1 FROM home GROUP BY 1, tag1 ``` /shared/influxdb3-query-guides/sql/aggregate-select.md