{{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 no column named metric is found the column name of the value column is used as series name)

Table:
- return any set of columns

Macros:
- $__time(column) -> column as "time"
- $__timeEpoch -> extract(epoch from column) as "time"
- $__timeFilter(column) -> column BETWEEN '2017-04-21T05:01:17Z' AND '2017-04-21T05:01:17Z'
- $__unixEpochFilter(column) ->  column >= 1492750877 AND column <= 1492750877
- $__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'),
  sum(value) as value
FROM yourtable
GROUP BY time
ORDER BY time

Or build your own conditionals using these macros which just return the values:
- $__timeFrom() ->  '2017-04-21T05:01:17Z'
- $__timeTo() ->  '2017-04-21T05:01:17Z'
- $__unixEpochFrom() ->  1492750877
- $__unixEpochTo() ->  1492750877
		
{{ctrl.lastQueryError}}