我是SQL查詢中的新成員。我打算在HANA Express中加入2個表格,並獲得一個表格的兩列中的最大值並將其與另一個表格結合起來。下面是場景:獲取列的最大值並將它們與另一個表結合
Table A
+-----+----------------+
| Key | Value |
+-----+----------------+
| 1 | Value is 1 |
| 2 | Value is 2 |
| 3 | Value is 3 |
+-----+----------------+
Table B
+-----+----------------------------+------+
| Seq | Timestamp | Key |
+-----+----------------------------+------+
| 500 | Feb 3, 2017 6:35:59.742 PM | 1 |
| 501 | Feb 3, 2017 6:35:59.742 PM | 2 |
| 502 | Feb 3, 2017 6:36:05.758 PM | 2 |
| 503 | Feb 3, 2017 6:36:05.758 PM | 4 |
| 504 | Feb 3, 2017 6:36:05.758 PM | 3 |
| 505 | Feb 3, 2017 6:36:09.766 PM | 5 |
+-----+----------------------------+------+
output table
+-----+------------+--------+----------------------------+--------------------------------+
| Key | Value | MaxSeq | LatestTimeStamp | ExecutionTime |
+-----+------------+--------+----------------------------+--------------------------------+
| 1 | Value is 1 | 505 | Feb 3, 2017 6:36:09.766 PM | (execution time of this query) |
| 2 | Value is 2 | 505 | Feb 3, 2017 6:36:09.766 PM | (execution time of this query) |
| 3 | Value is 3 | 505 | Feb 3, 2017 6:36:09.766 PM | (execution time of this query) |
+-----+------------+--------+----------------------------+--------------------------------+
所以這裏的MaxSeq將表B中序列列的最大值和LatestTimeStamp是表B的時間戳列的最新時間戳和他們都將在連接表不變。執行時間從HANA中的Current_Timestamp
函數計算得出。它甚至有可能嗎?
和'ExecutionTime'?或者解釋它是如何計算的或從問題中移除的。 –
謝謝。添加了執行時間的解釋。 –