Search code examples
tdengine

how to use state_window in TDengine query


From official document, there is a state_window in query grammar like below:

SELECT select_expr [, select_expr ...]
    FROM {tb_name_list}
    [WHERE where_condition]
    [SESSION(ts_col, tol_val)]
    [STATE_WINDOW(col)]
    [INTERVAL(interval_val [, interval_offset]) [SLIDING sliding_val]]
    [FILL(fill_mod_and_val)]
    [GROUP BY col_list]
    [ORDER BY col_list { DESC | ASC }]
    [SLIMIT limit_val [SOFFSET offset_val]]
    [LIMIT limit_val [OFFSET offset_val]]
    [>> export_file];

what is state_window and how to use it?


Solution

  • There is a directions of state_window in taos website, you can refer: https://www.taosdata.com/docs/cn/v2.0/taos-sql#aggregation