title: How do I group by on calculated columns?
body: <p>Assume the following table with 3 numeric fields:</p>
  
  <pre><code>Images (table)
  --------------
  Width
  Height
  Amount
  </code></pre>
  
  <p>Width and Height are image sizes in millimeters. Now I want to create a report about the amount of images grouped by their dimensions in centimeters. This means that I have to GROUP BY 2 non existing columns.</p>
  
  <p>I can do:</p>
  
  <pre><code>SELECT      ROUND(Width/10,0)   AS W
          ,   ROUND(Height/10,0)  AS H
          ,   SUM(Amount)         AS A 
  FROM        IMAGES
  GROUP BY    Width
          ,   Height 
  ORDER BY    W
          ,   H
          ,   A
  </code></pre>
  
  <p>but this will do the mm to cm conversion only on the view level and will result in more than one row for same dimensions.</p>
  
  <p>e.g.</p>
  
  <pre><code> W   H  A
  --- --- - 
  150 159 2
  150 160 1
  </code></pre>
  
  <p>will not result in 1 category</p>
  
  <pre><code>W  H  A
  -- -- - 
  15 16 3
  </code></pre>
  
  <p>but in </p>
  
  <pre><code>W  H  A
  -- -- - 
  15 16 2
  15 16 1
  </code></pre>
  
  <p>The targeted engine is actually a FileMaker database, that unfortunatly does not seem to support aggregate functions within the GROUP BY clause.</p>