I have the following table
| rownum | ID | date | owner |
|---|---|---|---|
| 1 | 1 | 09/01/2022 | null |
| 2 | 1 | 09/02/2022 | null |
| 3 | 1 | 09/03/2022 | Joe |
| 4 | 1 | 09/04/2022 | null |
| 5 | 1 | 09/05/2022 | Jack |
| 6 | 2 | 09/01/2022 | null |
| 7 | 2 | 09/02/2022 | John |
| 8 | 2 | 09/02/2022 | John |
| 9 | 2 | 09/02/2022 | John |
For every ID, I want to select the first occurrence of null that eventually results in a non-null value. So rows 1, 4, and 6.
(Note that rownum is not a column; I just added it here for illustration only)
Query output:
| ID | date | owner |
|---|---|---|
| 1 | 09/01/2022 | null |
| 1 | 09/04/2022 | null |
| 2 | 09/01/2022 | null |
What is the best way to go about it on an Oracle 11g DB?
