I have devices which are installed in a different location with different area ID I am returning the device activity status of different areas on an hourly basis in the following format.

```
AreaId  |   UpdatedOn             | DeviceStatus
  1     | 2018-08-08 00:00:00.000 | Active
  1     | 2018-08-08 01:00:00.000 | Active
  1     | 2018-08-08 02:00:00.000 | Active
  2     | 2018-08-08 00:00:00.000 | Inactive
  2     | 2018-08-08 01:00:00.000 | Active
  2     | 2018-08-08 02:00:00.000 | Active
  3     | 2018-08-08 00:00:00.000 | Active
  3     | 2018-08-08 01:00:00.000 | Inactive
  3     | 2018-08-08 02:00:00.000 | Inactive

```

As its clearly visible that Device 1 was active throughout. Device 2 was not active from 00.00 to 01.00 Hrs 
and device 3 was not active from 01.00 to 02.00 and 02.00 to 03.00 Hrs.

I want to show this data in the following format.

***Status of devices for 8 August 2018 from 0:00 Hrs to 3:00 Hrs*** 

```
Areaid     | Status
1          | Active
2          | Not Active between 00:00 hrs to 01:00 hrs
3          | Not Active between 01:00 hrs to 02:00 hrs and  02:00 hrs to 02:59hrs

```

for all the Areas.

How can I achieve this?