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:
Sven Klemm
2017-12-08 15:14:10 +01:00
committed by Daniel Lee
parent 0c5ef1453d
commit ce809de1ed
4 changed files with 7 additions and 7 deletions

View File

@ -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