Skip to content

Commit

Permalink
Merge pull request #22483 from taosdata/docs/join_event
Browse files Browse the repository at this point in the history
fix: document issues
  • Loading branch information
dapan1121 committed Aug 18, 2023
2 parents fbf80fb + 42b12b1 commit 8d3a164
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
7 changes: 3 additions & 4 deletions docs/en/12-taos-sql/06-select.md
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ The following SQL statement returns the number of subtables within the meters su
SELECT COUNT(*) FROM (SELECT DISTINCT TBNAME FROM meters);
```

In the preceding two statements, only tags can be used as filtering conditions in the WHERE clause. For example:
In the preceding two statements, only tags can be used as filtering conditions in the WHERE clause.

**\_QSTART and \_QEND**

Expand Down Expand Up @@ -209,8 +209,7 @@ You can perform INNER JOIN statements based on the primary key. The following co
3. For supertables, the ON condition must be equivalent to the primary key. In addition, the tag columns of the tables on which the INNER JOIN is performed must have a one-to-one relationship. You cannot specify an OR condition.
4. The tables that are included in a JOIN clause must be of the same type (supertable, standard table, or subtable).
5. You can include subqueries before and after the JOIN keyword.
6. You cannot include more than ten tables in a JOIN clause.
7. You cannot include a FILL clause and a JOIN clause in the same statement.
6. You cannot include a FILL clause and a JOIN clause in the same statement.

## GROUP BY

Expand Down Expand Up @@ -355,7 +354,7 @@ SELECT AVG(CASE WHEN voltage < 200 or voltage > 250 THEN 220 ELSE voltage END) F

## JOIN

TDengine supports the `INTER JOIN` based on the timestamp primary key, that is, the `JOIN` condition must contain the timestamp primary key. As long as the requirement of timestamp-based primary key is met, `INTER JOIN` can be made between normal tables, sub-tables, super tables and sub-queries at will, and there is no limit on the number of tables.
TDengine supports the `INTER JOIN` based on the timestamp primary key, that is, the `JOIN` condition must contain the timestamp primary key. As long as the requirement of timestamp-based primary key is met, `INTER JOIN` can be made between normal tables, sub-tables, super tables and sub-queries at will, and there is no limit on the number of tables, primary key and other conditions must be combined with `AND` operator.

For standard tables:

Expand Down
7 changes: 3 additions & 4 deletions docs/zh/12-taos-sql/06-select.md
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ SELECT table_name, tag_name, tag_type, tag_value FROM information_schema.ins_tag
SELECT COUNT(*) FROM (SELECT DISTINCT TBNAME FROM meters);
```

以上两个查询均只支持在 WHERE 条件子句中添加针对标签(TAGS)的过滤条件。例如:
以上两个查询均只支持在 WHERE 条件子句中添加针对标签(TAGS)的过滤条件。

**\_QSTART/\_QEND**

Expand Down Expand Up @@ -209,8 +209,7 @@ TDengine 支持基于时间戳主键的 INNER JOIN,规则如下:
3. 对于超级表,ON 条件在时间戳主键的等值条件之外,还要求有可以一一对应的标签列等值条件,不支持 OR 条件。
4. 参与 JOIN 计算的表只能是同一种类型,即只能都是超级表,或都是子表,或都是普通表。
5. JOIN 两侧均支持子查询。
6. 参与 JOIN 的表个数上限为 10 个。
7. 不支持与 FILL 子句混合使用。
6. 不支持与 FILL 子句混合使用。

## GROUP BY

Expand Down Expand Up @@ -354,7 +353,7 @@ SELECT AVG(CASE WHEN voltage < 200 or voltage > 250 THEN 220 ELSE voltage END) F

## JOIN 子句

TDengine 支持基于时间戳主键的内连接,即 JOIN 条件必须包含时间戳主键。只要满足基于时间戳主键这个要求,普通表、子表、超级表和子查询之间可以随意的进行内连接,且对表个数没有限制。
TDengine 支持基于时间戳主键的内连接,即 JOIN 条件必须包含时间戳主键。只要满足基于时间戳主键这个要求,普通表、子表、超级表和子查询之间可以随意的进行内连接,且对表个数没有限制,其它连接条件与主键间必须是 AND 操作

普通表与普通表之间的 JOIN 操作:

Expand Down
2 changes: 1 addition & 1 deletion docs/zh/12-taos-sql/12-distinguished.md
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ select max(current) from meters partition by location interval(10m)

## 窗口切分查询

TDengine 支持按时间窗口切分方式进行聚合结果查询,比如温度传感器每秒采集一次数据,但需查询每隔 10 分钟的温度平均值。这种场景下可以使用窗口子句来获得需要的查询结果。窗口子句用于针对查询的数据集合按照窗口切分成为查询子集并进行聚合,窗口包含时间窗口(time window)、状态窗口(status window)、会话窗口(session window)、条件窗口(event window)四种窗口。其中时间窗口又可划分为滑动时间窗口和翻转时间窗口。
TDengine 支持按时间窗口切分方式进行聚合结果查询,比如温度传感器每秒采集一次数据,但需查询每隔 10 分钟的温度平均值。这种场景下可以使用窗口子句来获得需要的查询结果。窗口子句用于针对查询的数据集合按照窗口切分成为查询子集并进行聚合,窗口包含时间窗口(time window)、状态窗口(status window)、会话窗口(session window)、事件窗口(event window)四种窗口。其中时间窗口又可划分为滑动时间窗口和翻转时间窗口。

窗口子句语法如下:

Expand Down

0 comments on commit 8d3a164

Please sign in to comment.