title: SQL: windowed aggregate functions for DB2 iSeries
body: <p>Is <code>count</code> not a valid aggregation function for row partitions for SQL DB2 on the iSeries?</p>
  
  <p>This query works:</p>
  
  <pre><code>select ROW_NUMBER() over (partition by COL1, COL2 order by COL3 asc)
  from MyTable
  </code></pre>
  
  <p>And this query gives a syntax error:</p>
  
  <pre><code>select COUNT(1) over (partition by COL1, COL2)
  from MyTable
  </code></pre>
  
  <p>The error message is pointing at the parenthesis before the word <code>partition</code>: </p>
  
  <blockquote>
    <p>[Message SQL0401] Token ( is not a valid token. A partial list of valid tokens is , FROM INTO.</p>
  </blockquote>
  
  <p>I'm aware I can rewrite the query to avoid the row partition, but I'd like to know why this isn't working.</p>