This is an automated email from the ASF dual-hosted git repository.

jackietien pushed a commit to branch AddLastQueryDoc
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit d2c32b1511ae40e7283d3a1c99322458d10920f0
Author: JackieTien97 <[email protected]>
AuthorDate: Mon Sep 5 14:05:32 2022 +0800

    Add doc for last query order by timeseries
---
 docs/UserGuide/Query-Data/Last-Query.md    | 18 +++++++++++++++++-
 docs/zh/UserGuide/Query-Data/Last-Query.md | 18 +++++++++++++++++-
 2 files changed, 34 insertions(+), 2 deletions(-)

diff --git a/docs/UserGuide/Query-Data/Last-Query.md 
b/docs/UserGuide/Query-Data/Last-Query.md
index d22fd52a39..80134b4087 100644
--- a/docs/UserGuide/Query-Data/Last-Query.md
+++ b/docs/UserGuide/Query-Data/Last-Query.md
@@ -28,7 +28,7 @@ The last query is to return the most recent data point of the 
given timeseries i
 The SQL syntax is defined as:
 
 ```sql
-select last <Path> [COMMA <Path>]* from < PrefixPath > [COMMA < PrefixPath >]* 
<WhereClause>
+select last <Path> [COMMA <Path>]* from < PrefixPath > [COMMA < PrefixPath >]* 
<WhereClause> [ORDER BY TIMESERIES (DESC | ASC)?]
 ```
 
 which means: Query and return the last data points of timeseries 
prefixPath.path.
@@ -68,4 +68,20 @@ IoTDB> select last status, temperature from 
root.ln.wf01.wt01 where time >= 2017
 
+-----------------------------+-----------------------------+---------+--------+
 Total line number = 2
 It costs 0.002s
+```
+
+## Order By timeseries
+
+**Example 3:** get the last points of all sensor in root.ln.wf01.wt01, and 
order the result by the timeseries column desc
+
+```
+IoTDB> select last * from root.ln.wf01.wt01 order by timeseries desc;
++-----------------------------+-----------------------------+---------+--------+
+|                         Time|                   timeseries|    
value|dataType|
++-----------------------------+-----------------------------+---------+--------+
+|2017-11-07T23:59:00.000+08:00|root.ln.wf01.wt01.temperature|21.067368|  
DOUBLE|
+|2017-11-07T23:59:00.000+08:00|     root.ln.wf01.wt01.status|    false| 
BOOLEAN|
++-----------------------------+-----------------------------+---------+--------+
+Total line number = 2
+It costs 0.002s
 ```
\ No newline at end of file
diff --git a/docs/zh/UserGuide/Query-Data/Last-Query.md 
b/docs/zh/UserGuide/Query-Data/Last-Query.md
index 6c657b0dde..2084cc0823 100644
--- a/docs/zh/UserGuide/Query-Data/Last-Query.md
+++ b/docs/zh/UserGuide/Query-Data/Last-Query.md
@@ -26,7 +26,7 @@
 SQL 语法:
 
 ```sql
-select last <Path> [COMMA <Path>]* from < PrefixPath > [COMMA < PrefixPath >]* 
<whereClause>
+select last <Path> [COMMA <Path>]* from < PrefixPath > [COMMA < PrefixPath >]* 
<whereClause> [ORDER BY TIMESERIES (DESC | ASC)?]
 ```
 
 其含义是:查询时间序列 prefixPath.path 中最近时间戳的数据。
@@ -66,4 +66,20 @@ IoTDB> select last status, temperature from 
root.ln.wf01.wt01 where time >= 2017
 
+-----------------------------+-----------------------------+---------+--------+
 Total line number = 2
 It costs 0.002s
+```
+
+## 将结果集根据序列名进行排序
+
+**示例 3:** 查询 root.ln.wf01.wt01 下所有序列的最新数据点,并按照序列名降序排列。
+
+```
+IoTDB> select last * from root.ln.wf01.wt01 order by timeseries desc;
++-----------------------------+-----------------------------+---------+--------+
+|                         Time|                   timeseries|    
value|dataType|
++-----------------------------+-----------------------------+---------+--------+
+|2017-11-07T23:59:00.000+08:00|root.ln.wf01.wt01.temperature|21.067368|  
DOUBLE|
+|2017-11-07T23:59:00.000+08:00|     root.ln.wf01.wt01.status|    false| 
BOOLEAN|
++-----------------------------+-----------------------------+---------+--------+
+Total line number = 2
+It costs 0.002s
 ```
\ No newline at end of file

Reply via email to