diff --git a/src/UserGuide/Master/Table/Basic-Concept/Query-Data.md b/src/UserGuide/Master/Table/Basic-Concept/Query-Data.md index 6f8707401..d096be94e 100644 --- a/src/UserGuide/Master/Table/Basic-Concept/Query-Data.md +++ b/src/UserGuide/Master/Table/Basic-Concept/Query-Data.md @@ -139,7 +139,6 @@ IoTDB> SELECT time, temperature, humidity Total line number = 7 It costs 0.106s ``` - **Example 3:Multi device time aligned query** ```SQL @@ -196,7 +195,7 @@ It costs 0.278s **Example**: Retrieve the latest record for each `device_id`, including the temperature value and the timestamp of the last record. ```SQL -IoTDB> SELECT device_id,last(temperature),last_by(time,temperature) +IoTDB> SELECT device_id,last(time),last_by(temperature,time) FROM table1 GROUP BY device_id; ``` @@ -204,12 +203,12 @@ IoTDB> SELECT device_id,last(temperature),last_by(time,temperature) **Result**: ```SQL -+---------+-----+-----------------------------+ -|device_id|_col1| _col2| -+---------+-----+-----------------------------+ -| 100| 90.0|2024-11-29T18:30:00.000+08:00| -| 101| 90.0|2024-11-30T14:30:00.000+08:00| -+---------+-----+-----------------------------+ ++---------+-----------------------------+-----+ +|device_id| _col1|_col2| ++---------+-----------------------------+-----+ +| 100|2024-11-29T18:30:00.000+08:00| 90.0| +| 101|2024-11-30T14:30:00.000+08:00| 90.0| ++---------+-----------------------------+-----+ Total line number = 2 It costs 0.090s ``` diff --git a/src/UserGuide/latest-Table/Basic-Concept/Query-Data.md b/src/UserGuide/latest-Table/Basic-Concept/Query-Data.md index 2a450e734..d096be94e 100644 --- a/src/UserGuide/latest-Table/Basic-Concept/Query-Data.md +++ b/src/UserGuide/latest-Table/Basic-Concept/Query-Data.md @@ -195,7 +195,7 @@ It costs 0.278s **Example**: Retrieve the latest record for each `device_id`, including the temperature value and the timestamp of the last record. ```SQL -IoTDB> SELECT device_id,last(temperature),last_by(time,temperature) +IoTDB> SELECT device_id,last(time),last_by(temperature,time) FROM table1 GROUP BY device_id; ``` @@ -203,12 +203,12 @@ IoTDB> SELECT device_id,last(temperature),last_by(time,temperature) **Result**: ```SQL -+---------+-----+-----------------------------+ -|device_id|_col1| _col2| -+---------+-----+-----------------------------+ -| 100| 90.0|2024-11-29T18:30:00.000+08:00| -| 101| 90.0|2024-11-30T14:30:00.000+08:00| -+---------+-----+-----------------------------+ ++---------+-----------------------------+-----+ +|device_id| _col1|_col2| ++---------+-----------------------------+-----+ +| 100|2024-11-29T18:30:00.000+08:00| 90.0| +| 101|2024-11-30T14:30:00.000+08:00| 90.0| ++---------+-----------------------------+-----+ Total line number = 2 It costs 0.090s ``` diff --git a/src/zh/UserGuide/Master/Table/Basic-Concept/Query-Data.md b/src/zh/UserGuide/Master/Table/Basic-Concept/Query-Data.md index 415d62e57..6dd453e15 100644 --- a/src/zh/UserGuide/Master/Table/Basic-Concept/Query-Data.md +++ b/src/zh/UserGuide/Master/Table/Basic-Concept/Query-Data.md @@ -197,7 +197,7 @@ It costs 0.278s **示例:查询表中每个 `device_id` 返回最后一条记录,包含该记录的温度值以及在该设备中基于时间和温度排序的最后一条记录。** ```SQL -IoTDB> SELECT device_id,last(temperature),last_by(time,temperature) +IoTDB> SELECT device_id,last(time),last_by(temperature,time) FROM table1 GROUP BY device_id; ``` @@ -205,12 +205,12 @@ IoTDB> SELECT device_id,last(temperature),last_by(time,temperature) 执行结果如下: ```SQL -+---------+-----+-----------------------------+ -|device_id|_col1| _col2| -+---------+-----+-----------------------------+ -| 100| 90.0|2024-11-29T18:30:00.000+08:00| -| 101| 90.0|2024-11-30T14:30:00.000+08:00| -+---------+-----+-----------------------------+ ++---------+-----------------------------+-----+ +|device_id| _col1|_col2| ++---------+-----------------------------+-----+ +| 100|2024-11-29T18:30:00.000+08:00| 90.0| +| 101|2024-11-30T14:30:00.000+08:00| 90.0| ++---------+-----------------------------+-----+ Total line number = 2 It costs 0.090s ``` diff --git a/src/zh/UserGuide/latest-Table/Basic-Concept/Query-Data.md b/src/zh/UserGuide/latest-Table/Basic-Concept/Query-Data.md index 415d62e57..6dd453e15 100644 --- a/src/zh/UserGuide/latest-Table/Basic-Concept/Query-Data.md +++ b/src/zh/UserGuide/latest-Table/Basic-Concept/Query-Data.md @@ -197,7 +197,7 @@ It costs 0.278s **示例:查询表中每个 `device_id` 返回最后一条记录,包含该记录的温度值以及在该设备中基于时间和温度排序的最后一条记录。** ```SQL -IoTDB> SELECT device_id,last(temperature),last_by(time,temperature) +IoTDB> SELECT device_id,last(time),last_by(temperature,time) FROM table1 GROUP BY device_id; ``` @@ -205,12 +205,12 @@ IoTDB> SELECT device_id,last(temperature),last_by(time,temperature) 执行结果如下: ```SQL -+---------+-----+-----------------------------+ -|device_id|_col1| _col2| -+---------+-----+-----------------------------+ -| 100| 90.0|2024-11-29T18:30:00.000+08:00| -| 101| 90.0|2024-11-30T14:30:00.000+08:00| -+---------+-----+-----------------------------+ ++---------+-----------------------------+-----+ +|device_id| _col1|_col2| ++---------+-----------------------------+-----+ +| 100|2024-11-29T18:30:00.000+08:00| 90.0| +| 101|2024-11-30T14:30:00.000+08:00| 90.0| ++---------+-----------------------------+-----+ Total line number = 2 It costs 0.090s ```