只有在PostgreSQL中打開和關閉事件之間獲得行的最佳方式是什麼?使用分區格式化表格
+------------+----+------------+---------------------+
| event_id | ID | occurrence | datetime |
+------------+----+------------+---------------------+
| 1003603017 | A | owner_from | 12/16/2016 4:44:16 |
| 1003603017 | A | owner_to | 12/16/2016 4:44:38 |
| 1003603017 | A | owner_from | 12/16/2016 4:44:38 |
| 1003603017 | A | opened | 12/16/2016 4:44:39 |
| 1003603017 | B | owner_from | 12/16/2016 7:36:23 |
| 1003603017 | A | owner_to | 12/16/2016 7:36:23 |
| 1003603017 | B | owner_to | 12/16/2016 9:00:01 |
| 1003603017 | C | owner_from | 12/16/2016 9:00:01 |
| 1003603017 | A | closed | 12/16/2016 12:00:36 |
| 1003603017 | D | owner_from | 12/17/2016 4:25:00 |
| 1003603017 | C | owner_to | 12/17/2016 4:25:00 |
| 1003603017 | D | owner_from | 12/17/2016 4:52:02 |
| 1003603017 | D | owner_to | 12/17/2016 4:52:02 |
| 1003603017 | D | opened | 12/17/2016 4:52:02 |
| 1003603017 | D | owner_to | 12/17/2016 8:57:00 |
| 1003603017 | E | owner_from | 12/17/2016 8:57:00 |
| 1003603017 | D | closed | 12/17/2016 12:03:10 |
+------------+----+------------+---------------------+
你怎麼想作爲輸出? –
你試過了什麼?向我們展示您當前的查詢嘗試。 – jarlh