By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
CREATE TABLE
INSERT 0 6
| datetime | s_1_max | s_2_max |
|---|---|---|
| 2023-01-01 00:00:00+00 | 3 | 10 |
| 2023-01-02 00:00:00+00 | 4 | 9.3 |
SELECT 2
| datetime | col | val |
|---|---|---|
| 2023-01-01 10:00:00+00 | s_1 | 3 |
| 2023-01-01 11:00:00+00 | s_2 | 10 |
| 2023-01-01 23:00:00+00 | s_1 | 4 |
| 2023-01-02 10:00:00+00 | s_2 | 9.3 |
SELECT 4