I have the below table.
| ID | Desc | progress | updated_time |
|---|---|---|---|
| 1 | abcd | planned | 2022-04-20 10:00AM |
| 1 | abcd | planned | 2022-04-25 12:00AM |
| 1 | abcd | in progress | 2022-04-26 4:00PM |
| 1 | abcd | in progress | 2022-05-04 11:00AM |
| 1 | abcd | in progress | 2022-05-06 12:00PM |
I just want to return a row that has the latest updated_time regardless of what progress it is in, which is,
| ID | Desc | progress | updated_time |
|---|---|---|---|
| 1 | abcd | in progress | 2022-05-06 12:00PM |
I know if I group by 'progress' (as shown below), I will get one for planned too which I do not need. I just need a single row for each ID with its latest updated time.
I wrote the following query,
select ID,desc,progress,updated_time
from t1
where updated_time IN (select ID, desc, progress, max(updated_time)
from t1 group by 1,2,3)
I get the following error too, 'Multiple columns returned by subquery are not yet supported'