diff --git a/public/app/plugins/datasource/mssql/CheatSheet.tsx b/public/app/plugins/datasource/mssql/CheatSheet.tsx new file mode 100644 index 00000000000..73849ec7a31 --- /dev/null +++ b/public/app/plugins/datasource/mssql/CheatSheet.tsx @@ -0,0 +1,91 @@ +import { css } from '@emotion/css'; +import React from 'react'; + +import { GrafanaTheme2 } from '@grafana/data'; +import { useStyles2 } from '@grafana/ui'; + +export function CheatSheet() { + const styles = useStyles2(getStyles); + + return ( +
Resultsets of time series queries need to be sorted by time.
+ Table: +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:
+ Resultsets of time series queries need to be sorted by time.
+ Table: +Example of group by and order by with $__timeGroup:
+
+
+ $__timeGroupAlias(timestamp_col, '1h'), sum(value_double) as value
+
+ FROM yourtable
+
+ GROUP BY 1
+ ORDER BY 1
+
+
+
+ Or build your own conditionals using these macros which just return the values:
+ Resultsets of time series queries need to be sorted by time.
+ Table: +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:
+