title: SQL Sum Over Partition Order by
body: <p>I am using below query in SQL and it is giving an error saying </p>
  
  <blockquote>
    <p>Incorrect syntax near 'order'.</p>
  </blockquote>
  
  <p>I want to get cumulative value for the column increment_inch. This column value should change as Device changes.</p>
  
  <p>Can you anyone tell me what is wrong?</p>
  
  <pre><code>SELECT TSI.INCREMENT_SEQ_NUM as STRAPPING,
         TSI.INCREMENT_INCH as #_of_INCREMENTS,
         TSI.VOLUME_BBL as FACTOR_PER_INCREMENT,
         SUM(increment_inch) OVER (PARTITION BY ts.master_device_id ORDER BY TSI.INCREMENT_SEQ_NUM) AS CUMULATIVE_INCREMENTS
  FROM TANK_STRAPPING TS INNER JOIN  
       TANK_STRAPPING_INCREMENT TSI
       ON TS.STRAPPING_ID = TSI.STRAPPING_ID 
  </code></pre>