瀏覽代碼

mssql: update query editor help

Marcus Efraimsson 7 年之前
父節點
當前提交
bd4ecaeac6
共有 1 個文件被更改,包括 8 次插入0 次删除
  1. 8 0
      public/app/plugins/datasource/mssql/partials/query.editor.html

+ 8 - 0
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]) -&gt; CAST(ROUND(DATEDIFF(second, '1970-01-01', column)/300.0, 0) as bigint)*300. Providing a <i>fillValue</i> of <i>NULL</i> 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() -&gt; DATEADD(second, 1492750877, '1970-01-01')
 - $__timeTo() -&gt; DATEADD(second, 1492750877, '1970-01-01')