title: Oracle SQL -- Analytic functions OVER a group?
body: <p>My table:</p>
  
  <pre><code>ID   NUM   VAL
  1    1     Hello
  1    2     Goodbye
  2    2     Hey
  2    4     What's up?
  3    5     See you
  </code></pre>
  
  <p>If I want to return the max number for each ID, it's really nice and clean:</p>
  
  <pre><code>SELECT MAX(NUM) FROM table GROUP BY (ID)
  </code></pre>
  
  <p>But what if I want to grab the value associated with the max of each number for each ID?</p>
  
  <p>Why can't I do:</p>
  
  <pre><code>SELECT MAX(NUM) OVER (ORDER BY NUM) FROM table GROUP BY (ID) 
  </code></pre>
  
  <p>Why is that an error? I'd like to have this select grouped by ID, rather than partitioning separately for each window...</p>
  
  <p>EDIT: The error is "not a GROUP BY expression".</p>