title: Problem in formatting result set in desired format
body: <p>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.</p>
  
  <pre><code>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
  </code></pre>
  
  <p>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.</p>
  
  <p>I want to show this data in the following format.</p>
  
  <p><strong><em>Status of devices for 8 August 2018 0:00 Hrs to 03:00 Hrs</em></strong> </p>
  
  <pre><code>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 03:00 hrs
  </code></pre>
  
  <p>for all the Areas.</p>
  
  <p>How can I achieve this?</p>