title: Category and Sub category in one column in sql
body: <p>How we can show <code>category</code> and <code>subcategory</code> in one column in sql. Both columns are present in same table <code>TableA</code>.</p>
  
  <p>Example: <code>TableA</code></p>
  
  <pre><code>--------------------------------------
  | category |  subcategory |  Values  |
  --------------------------------------
  | Bird     |  parrot       |     5   |
  | Bird     |  pigeon       |     10  |
  | Animal   |  lion         |     2   |
  | Animal   |  Tiger        |     5   |
  --------------------------------------
  </code></pre>
  
  <p>Output table :</p>
  
  <pre><code>-------------------
  | NEW    |  Value  |
  --------------------
  | Bird   |   15    |
  | parrot |   5     |
  | Piegon |   10    |
  | Animal |   7     |
  | lion   |   2     |
  | Tiger  |   5     |
  --------------------
  </code></pre>
  
  <p>In the output, New is a column where I want both category and sub category.</p>
  
  <p>Sample Query to generate data:</p>
  
  <pre><code>CREATE TABLE #TEMP
  (
  catgory nvarchar(200),
  sub_category nvarchar(200),
  [values] nvarchar(200),
  )
  
  INSERT INTO #TEMP VALUES ('Bird','parrot',5)
  INSERT INTO #TEMP  VALUES ('Bird','pigeon',10)
  INSERT INTO #TEMP VALUES ('Animal','lion',2)
  INSERT INTO #TEMP VALUES ('Animal','Tiger',5)
  </code></pre>
  
  <p>Where the logic is:</p>
  
  <p>I want category and sub category together, Where category should show the sum of all sub category values and should be in order as I have output table</p>