mirror of
https://github.com/grafana/grafana.git
synced 2025-08-06 20:59:35 +08:00
postgres: change $__timeGroup macro to include "AS time" column alias (#10119)
* change $__timeGroup macro to include column alias * update docs and help text for $__timeGroup macro
This commit is contained in:
@ -50,11 +50,11 @@ Macros:
|
||||
- $__timeEpoch -> extract(epoch from column) as "time"
|
||||
- $__timeFilter(column) -> extract(epoch from column) BETWEEN 1492750877 AND 1492750877
|
||||
- $__unixEpochFilter(column) -> column > 1492750877 AND column < 1492750877
|
||||
- $__timeGroup(column,'5m') -> (extract(epoch from "dateColumn")/300)::bigint*300
|
||||
- $__timeGroup(column,'5m') -> (extract(epoch from column)/300)::bigint*300 AS time
|
||||
|
||||
Example of group by and order by with $__timeGroup:
|
||||
SELECT
|
||||
$__timeGroup(date_time_col, '1h') AS time,
|
||||
$__timeGroup(date_time_col, '1h'),
|
||||
sum(value) as value
|
||||
FROM yourtable
|
||||
GROUP BY time
|
||||
|
Reference in New Issue
Block a user