title: Custom Order for Max()
body: <p>I want to get the "max" character value for a column using a group by statement, except instead of the default alphabetical order, I want to set up a custom ordering that the max will use.</p>
  
  <p>Table1:</p>
  
  <pre><code>  ID  |  TYPE  
   -----+-------
    1   |   A
    1   |   B
    1   |   C
    2   |   A
    2   |   B
  </code></pre>
  
  <p>I want to group by ID and get max(type) in the order of C, A, B.  Expected result:</p>
  
  <pre><code>  ID  |  MAX_TYPE  
   -----+-----------
    1   |   C
    2   |   A
  </code></pre>