{{ctrl.lastQueryMeta.sql}}
Time series:
- return column named time (UTC in seconds or timestamp)
- return column(s) with numeric datatype as values
Optional:
  - return column named metric to represent the series name.
  - If multiple value columns are returned the metric column is used as prefix.
  - If no column named metric is found the column name of the value column is used as series name

Resultsets of time series queries need to be sorted by time.

Table:
- return any set of columns

Macros:
- $__timeFilter(column) -> column BETWEEN '2017-04-21T05:01:17Z' AND '2017-04-21T05:01:17Z'
- $__timeFrom(column) -> column > '2017-04-21T05:01:17Z'
- $__timeTo(column) -> column < '2017-04-21T05:01:17Z'
- $__timeGroup(column,'5m') -> (extract(epoch from column)/300)::bigint*300 AS "time"
- $__timeShifting(1m) -> compare data from the current range to the previous range
- $__millisTimeFrom(time) -> Translate time ito millis
- __millisTimeTo(time) -> Translate time ito millis

Example of group by and order by with $__timeGroup:
SELECT
  $__timeGroup(date_time_col, '1h'),
  sum(value) as value
FROM yourtable
GROUP BY time
ORDER BY time

    
{{ctrl.lastQueryError}}