title: Summing record in table based on key in row
body: <p>The table is a big table,millions of records. </p>
  
  <p>Column X represents an item etc Table, chair... ...
  Column Y has values which i would like to sum up.
  Column Z would place the value if the row needs to be summed.</p>
  
  <pre><code>Table 1
  
  ID     Column X    Column Y    Column Z   
  1      X1          5           1
  2      x1          4           1
  3      x1          Null        0
  4      x1          5           1
  5      x1          Null        0
  6      x2          5           1
  7      x2          5           1
  8      x2          Null        0
  9      x3          2           1
  10     x3          Null        0
  11     x3          2           1
  12     x4          Null        0
  13     x4          Null        0
  14     x5          Null        0
  ...  ...
  the list goes on
  
  Wanted Result
  Table 1
  ID     Column X    Column YY   Column Z   
  1      X1          14          1
  2      x1          14          1
  3      x1          14          0
  4      x1          14          1
  5      x1          14          0
  6      x2          10          1
  7      x2          10          1
  8      x2          10          0
  9      x3          4           1
  10     x3          4           0
  11     x3          4           1
  12     x4          0           0
  13     x4          0           0
  14     x5          0           0
  </code></pre>
  
  <p>I would require a select statement to get the intended result.</p>