From bd4ecaeac6e6737ac44043c90ba9a574cfea433f Mon Sep 17 00:00:00 2001 From: Marcus Efraimsson Date: Thu, 22 Mar 2018 15:46:40 +0100 Subject: [PATCH] mssql: update query editor help --- .../plugins/datasource/mssql/partials/query.editor.html | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/public/app/plugins/datasource/mssql/partials/query.editor.html b/public/app/plugins/datasource/mssql/partials/query.editor.html index f8c7effb827..c7dc030be6e 100644 --- a/public/app/plugins/datasource/mssql/partials/query.editor.html +++ b/public/app/plugins/datasource/mssql/partials/query.editor.html @@ -53,6 +53,14 @@ Macros: - $__unixEpochFilter(column) -> column >= 1492750877 AND column <= 1492750877 - $__timeGroup(column, '5m'[, fillvalue]) -> CAST(ROUND(DATEDIFF(second, '1970-01-01', column)/300.0, 0) as bigint)*300. Providing a fillValue of NULL or floating value will automatically fill empty series in timerange with that value. +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 $__timeGroup(date_time_col, '1h') +ORDER BY 1 + Or build your own conditionals using these macros which just return the values: - $__timeFrom() -> DATEADD(second, 1492750877, '1970-01-01') - $__timeTo() -> DATEADD(second, 1492750877, '1970-01-01')