title: How to get count for different values in different columns in SQL
body: <p>I have a chart table like below</p>
  
  <pre><code>+----------------------------------------------------------+
  |  ID | REGION | STATUS | CLOSED_DT |HEALTH  | Open_DT     |
  +----------------------------------------------------------+
  |   1 | QA     | open   |  -        |  red   | 2016-01-03  |
  |   2 | QA     | open   |  -        | green  | 2015-03-03  |
  |   3 | QA     | open   |  -        | orange | 2016-02-03  |
  |   4 | QA     | open   |  -        | red    | 2016-01-03  |
  |   5 | x      | closed |  16-03-03 | green  | 2015-06-03  |
  |   6 | Req    | open   |  -        | orange | 2015-05-03  |
  |   7 | x      | closed |  16-02-02 | green  | 2015-05-03  |
  +----------------------------------------------------------+
  </code></pre>
  
  <p>I want to display three charts - bar chart , pie chart , month wise trend chart. First chart requires count of different region for open status. </p>
  
  <blockquote>
    <p>select region, count (*) as total from chart where STATUS='open' group by region;</p>
  </blockquote>
  
  <p>I used the above query for bar chart. For pie chart i used the below query</p>
  
  <blockquote>
    <p>select health, count (*) as total from chart where STATUS='open' group by health;</p>
  </blockquote>
  
  <p>Next is month wise chart where i need to display for the last twelve month For eg from Jan to Dec , i need number of open and closed for each month. How to frame the query to get the count of open and closed status for last twelve months from current date. Also instead of executing three different queries for each chart , is there any way to use a single query. I need query for both Oracle and Mssql</p>