【发布时间】:2021-04-29 07:40:11
【问题描述】:
我有一张如下所示的表格。
| id | job_id | object | message | last_Exception | second_last_Exception |
|---|---|---|---|---|---|
| 312 | 1 | abc | deadlock | 26-04-2021 | null |
| 312 | 0 | abc | connection reset | null | 25-04-2021 |
| 313 | 0 | cde | connection reset | 25-04-2021 | null |
| 313 | 1 | cde | deadlock | null | 24-04-2021 |
基本上我必须打印每个对象的最新记录,如果 second_last_Exception_time 为空,那么它应该从下一条记录中获取它。还假设对于单个对象将只有两行。
理想的输出应该是这样的。
| id | job_id | object | message | last_Exception | second_last_Exception |
|---|---|---|---|---|---|
| 312 | 1 | abc | deadlock | 26-04-2021 | 25-04-2021 |
| 313 | 0 | cde | connection reset | 25-04-2021 | 24-04-2021 |
【问题讨论】: