我是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'?或者解释它是如何计算的或从问题中移除的。 –
谢谢。添加了执行时间的解释。 –