未验证 提交 ed286e63 编写于 作者: H Haojun Liao 提交者: GitHub

Merge pull request #20855 from taosdata/54liuyao-patch-2

Update 06-stream.md
...@@ -52,7 +52,7 @@ CREATE TABLE d1004 USING meters TAGS ("California.LosAngeles", 3); ...@@ -52,7 +52,7 @@ CREATE TABLE d1004 USING meters TAGS ("California.LosAngeles", 3);
### 创建流 ### 创建流
```sql ```sql
create stream current_stream into current_stream_output_stb as select _wstart as start, _wend as wend, max(current) as max_current from meters where voltage <= 220 interval (5s); create stream current_stream trigger at_once into current_stream_output_stb as select _wstart as wstart, _wend as wend, max(current) as max_current from meters where voltage <= 220 interval (5s);
``` ```
### 写入数据 ### 写入数据
...@@ -70,8 +70,8 @@ insert into d1004 values("2018-10-03 14:38:06.500", 11.50000, 221, 0.35000); ...@@ -70,8 +70,8 @@ insert into d1004 values("2018-10-03 14:38:06.500", 11.50000, 221, 0.35000);
### 查询以观察结果 ### 查询以观察结果
```sql ```sql
taos> select start, wend, max_current from current_stream_output_stb; taos> select wstart, wend, max_current from current_stream_output_stb;
start | wend | max_current | wstart | wend | max_current |
=========================================================================== ===========================================================================
2018-10-03 14:38:05.000 | 2018-10-03 14:38:10.000 | 10.30000 | 2018-10-03 14:38:05.000 | 2018-10-03 14:38:10.000 | 10.30000 |
2018-10-03 14:38:15.000 | 2018-10-03 14:38:20.000 | 12.60000 | 2018-10-03 14:38:15.000 | 2018-10-03 14:38:20.000 | 12.60000 |
...@@ -89,7 +89,7 @@ Query OK, 2 rows in database (0.018762s) ...@@ -89,7 +89,7 @@ Query OK, 2 rows in database (0.018762s)
### 创建流 ### 创建流
```sql ```sql
create stream power_stream into power_stream_output_stb as select ts, concat_ws(".", location, tbname) as meter_location, current*voltage*cos(phase) as active_power, current*voltage*sin(phase) as reactive_power from meters partition by tbname; create stream power_stream trigger at_once into power_stream_output_stb as select ts, concat_ws(".", location, tbname) as meter_location, current*voltage*cos(phase) as active_power, current*voltage*sin(phase) as reactive_power from meters partition by tbname;
``` ```
### 写入数据 ### 写入数据
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册