So I have this event audit table
EventID | EventType | TaskID | Date | Iteration
--------------------------------------------------------------
1 | start | 12 | 01/01/2016 09:00 | 1
--------------------------------------------------------------
2 | ended | 12 | 01/01/2016 09:05 | 1
--------------------------------------------------------------
3 | start | 14 | 01/01/2016 09:10 | 1
--------------------------------------------------------------
4 | ended | 14 | 01/01/2016 09:15 | 1
--------------------------------------------------------------
5 | start | 12 | 01/01/2016 09:20 | 2
--------------------------------------------------------------
6 | ended | 12 | 01/01/2016 09:20 | 2
--------------------------------------------------------------
7 | ended | 98 | 01/01/2016 07:14 | 12
--------------------------------------------------------------
8 | start | 66 | 01/01/2016 09:27 | 1
Mostly there's pairs of started/ended events of tasks with different iterations. But sometime there's only started or only ended rows.
What I want To get:
| TaskID | Date Started | Date ended | Iteration
----------------------------------------------------------------------
| 12 | 01/01/2016 09:00 | 01/01/2016 09:05 | 1
----------------------------------------------------------------------
| 14 | 01/01/2016 09:10 | 01/01/2016 09:15 | 1
----------------------------------------------------------------------
| 12 | 01/01/2016 09:20 | 01/01/2016 09:20 | 2
----------------------------------------------------------------------
| 98 | - | 01/01/2016 07:14 | 12
----------------------------------------------------------------------
| 66 | 01/01/2016 09:27 | - | 1
How can I achieve that?
Oracle 11g