title: Handle Group by different way in postgres
body: <p>This query getting result like below</p>
  
  <pre><code>select date_part('hour', ts.a_start_time) AS hour,count(*) as c,
          count(*) FILTER (WHERE EXTRACT(dow FROM ts.a_start_time) = 0) AS s,
          count(*) FILTER (WHERE EXTRACT(dow FROM ts.a_start_time) = 1) AS m,
          count(*) FILTER (WHERE EXTRACT(dow FROM ts.a_start_time) = 2) AS t,
          count(*) FILTER (WHERE EXTRACT(dow FROM ts.a_start_time) = 3) AS w,
          count(*) FILTER (WHERE EXTRACT(dow FROM ts.a_start_time) = 4) AS th,
          count(*) FILTER (WHERE EXTRACT(dow FROM ts.a_start_time) = 5) AS f,
          count(*) FILTER (WHERE EXTRACT(dow FROM ts.a_start_time) = 6) AS sa
          from flight_schedules as fs 
          inner join resource_mapping as rm on rm.flight_schedules_id = fs.id 
          inner join task_schedule_details as tsd on tsd.id = rm.task_schedule_detail_id 
          inner join task_status as ts on ts.resource_mapping_id = rm.id 
          inner join task_master as tm on tm.id = tsd.task_id 
          inner join delay_code_master as dcm on dcm.id = ts.delay_code_id 
          inner join delay_categorization as dc on dc.id = dcm.delay_category_id
          Where fs.station=81 group by hour order by hour ASC
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/xUAIF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xUAIF.png" alt="enter image description here"></a></p>
  
  <p>But i want group by  hour like </p>
  
  <p><a href="https://i.stack.imgur.com/xUAIF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xUAIF.png" alt="enter image description here"></a></p>