title: SQL SUM based on first two characters of one column, one table
body: <p>I'm fairly new to SQL and have the following dilemma. I have the following  partial table:</p>
  
  <pre>Account  Description  ShortDescription  Balance
  ------------------------------------------------
  100001   Blah, blah   Blah, blah        28350.68
  100020     &quot;            &quot;               2537.35
  111000     &quot;            &quot;               86898.12
  111001     &quot;            &quot;               63943.63
  121000     &quot;            &quot;               55325.68
  121012     &quot;            &quot;               65264.35
  122000     &quot;            &quot;               94898.85</pre>
  
  <p>I need to SUM the Balance of all Account starting with the first two digits. So the first two Balance is summed, next two summed, next three summed, etc. Then I need to take those sums and create a grand total. </p>
  
  <p>The end table will include all of the columns, SubTotal, and GrandTotal. I can't figure out a good way to do this; I tried OVER - PARTITION BY with no success (SELECT SUM(Balance) OVER (PARTITION BY Account) AS SubTotal). Any help would be appreciated. Thanks in advance.</p>