By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
| Group | DateTime | Status | Col1 | Col2 |
|---|---|---|---|---|
| Group1 | 2019-01-01 01:02:03.000 | OFF | 201 | 202 |
| Group1 | 2019-01-01 01:02:03.000 | ON | 101 | 102 |
| Group2 | 2019-01-01 01:02:03.000 | OFF | 401 | 402 |
| Group2 | 2019-01-01 01:02:03.000 | ON | 301 | 302 |
| Group3 | 2019-01-01 01:02:03.000 | OFF | 601 | 602 |
| Group3 | 2019-01-01 01:02:03.000 | ON | 501 | 502 |
| Group | Datetime | (No column name) | (No column name) | (No column name) | (No column name) |
|---|---|---|---|---|---|
| Group1 | 2019-01-01 01:02:03.000 | 101 | 201 | 102 | 202 |
| Group2 | 2019-01-01 01:02:03.000 | 301 | 401 | 302 | 402 |
| Group3 | 2019-01-01 01:02:03.000 | 501 | 601 | 502 | 602 |
Warning: Null value is eliminated by an aggregate or other SET operation.