By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
| (No column name) |
|---|
| Microsoft SQL Server 2017 (RTM-CU21) (KB4557397) - 14.0.3335.7 (X64) Jun 12 2020 20:39:00 Copyright (C) 2017 Microsoft Corporation Express Edition (64-bit) on Windows Server 2019 Standard 10.0 <X64> (Build 17763: ) (Hypervisor) |
12 rows affected
| timestamp1 | category | grps_of_5 | max_val |
|---|---|---|---|
| 2018-10-01 04:06:12.000 | Cat1 | 1 | 1 |
| 2018-10-01 05:07:18.000 | Cat1 | 2 | 2 |
| 2018-10-01 05:07:19.000 | Cat1 | null | 2 |
| 2018-10-01 05:07:20.000 | Cat1 | null | 2 |
| 2018-10-01 05:15:20.000 | Cat1 | 5 | 5 |
| 2018-10-01 06:09:29.000 | Cat1 | 6 | 6 |
| 2018-10-01 07:24:12.000 | Cat2 | 1 | 1 |
| 2018-10-01 07:30:43.000 | Cat2 | 2 | 2 |
| 2018-10-01 07:59:13.000 | Cat2 | 3 | 3 |
| 2018-10-01 08:02:15.000 | Cat2 | null | 3 |
| 2018-10-01 10:09:25.000 | Cat2 | 5 | 5 |
| 2018-10-01 11:13:42.000 | Cat2 | 6 | 6 |
Warning: Null value is eliminated by an aggregate or other SET operation.
| category | cnt |
|---|---|
| Cat1 | 4 |
| Cat2 | 5 |
Warning: Null value is eliminated by an aggregate or other SET operation.