I have a table where each row has several dates. How can I select the min
of all the dates in the row?
Existing table:
Id | Date_1 | Date_2 |
---|---|---|
1 | 2021/10/25 | 2021/03/15 |
2 | 2021/08/21 | 2021/12/04 |
3 | 2021/07/02 | 2021/09/11 |
Expected result:
Id | Min_date |
---|---|
1 | 2021/03/15 |
2 | 2021/08/21 |
3 | 2021/07/02 |
Ideally something like: SELECT Id, least(Date_1, Date_2) from table
thought that doesn't work.