title: Cannot use group by and over(partition by) in the same query?
body: <p>I have a table <code>myTable</code> with 3 columns. <code>col_1</code> is an <code>INTEGER</code> and the other 2 columns are <code>DOUBLE</code>. For example, <code>col_1={1, 2}, col_2={0.1, 0.2, 0.3}</code>. Each element in <code>col_1</code> is composed of all the values of <code>col_2</code> and <code>col_2</code> has repeated values for each element in <code>col_1</code>. The 3rd column can have any value as shown below:</p>
  
  <pre><code>    col_1 | col_2 | Value
      ----------------------
      1     |  0.1  |  1.0
      1     |  0.2  |  2.0
      1     |  0.2  |  3.0
      1     |  0.3  |  4.0
      1     |  0.3  |  5.0
      2     |  0.1  |  6.0
      2     |  0.1  |  7.0
      2     |  0.1  |  8.0
      2     |  0.2  |  9.0
      2     |  0.3  |  10.0
  </code></pre>
  
  <p>What I want is to use an aggregate-function <code>SUM()</code> on the <code>Value</code> column partition by <code>col_1</code> and grouped by <code>col_2</code>. The Above table should look like this:</p>
  
  <pre><code>    col_1 | col_2 | sum_value
      ----------------------
      1     |  0.1  |  1.0
      1     |  0.2  |  5.0
      1     |  0.3  |  9.0
      2     |  0.1  |  21.0
      2     |  0.2  |  9.0
      2     |  0.3  |  10.0
  </code></pre>
  
  <p>I tried the following SQL query:</p>
  
  <pre><code>SELECT col_1, col_2, sum(Value) over(partition by col_1) as sum_value
  from myTable
  GROUP BY col_1, col_2
  </code></pre>
  
  <p>But on DB2 v10.5 it gave the following error:</p>
  
  <pre><code>SQL0119N  An expression starting with "Value" specified in a SELECT 
  clause, HAVING clause, or ORDER BY clause is not specified in the 
  GROUP BY clause or it is in a SELECT clause, HAVING clause, or ORDER 
  BY clause with a column function and no GROUP BY clause is specified.
  </code></pre>
  
  <p>Can you kindly point out what is wrong. I do not have much experience with SQL.</p>
  
  <p>Thank you.</p>