---
title: Trending with raw queries
slug: how-tos/V7aP-trending-with-raw-queries
docTags: b0MRn0pwHGvtU8ANosiar,8EU_tNMQjMdJ8KLDWLfi-,9-aBegWxFRRNdoBK02j-v
createdAt: 2025-09-25T09:07:48.065Z
---

## Why use a raw query?

- Allows advanced filtering, transformations, and calculations not yet available in the visual query editor.
- Useful for very specific data needs, or when replicating queries from another system.

## Example

:::CodeblockTabs
InfluxQL

```sql
SELECT mean("value") 
FROM "temperature_sensor" 
WHERE time >= now() - 24h 
GROUP BY time(1h) fill(previous)
```
:::

This query fetches hourly average temperature values from the last 24 hours, filling gaps with the previous value.

## Query reference

For detailed syntax, refer to the official query language docs:

- **[InfluxQL v1 Reference](https://docs.influxdata.com/influxdb/v1/query_language/spec/)**
- **[Flux (InfluxDB v2) Reference](https://docs.influxdata.com/influxdb/v2/query-data/)**
