{{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 ≥ to_timestamp(1492750877) AND column ≤ to_timestamp(1492750877)
- $__unixEpochFilter(column) ->  column > 1492750877 AND column < 1492750877
- $__timeGroup(column,'5m') -> (extract(epoch from "dateColumn")/extract(epoch from '5m'::interval))::int

Example of group by and order by with $__timeGroup:
SELECT
  $__timeGroup(date_time_col, '1h') AS time,
  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() ->  to_timestamp(1492750877)
- $__timeTo() ->  to_timestamp(1492750877)
- $__unixEpochFrom() ->  1492750877
- $__unixEpochTo() ->  1492750877
		
{{ctrl.lastQueryError}}