title: How does whileprintingrecords in Crystal Reports translate to SQL
body: <p>I'm looking for the value of Group1total in a Crystal Report. My background is more centered around SQL and I'm trying to determine the logic behind the following:</p>
  
  <pre><code>//{@Group1total}
  whileprintingrecords;
  numbervar group1cost
  
  //{@Group1cost}
  whileprintingrecords;
  numbervar group1cost := group1cost + {@group2total}
  
  //{@Group2total}
  whileprintingrecords;
  numbervar group2cost
  
  //{@Group2cost}
  whileprintingrecords;
  numbervar group2cost := group2cost + {@group3total}
  
  //{@Group3total}
  whileprintingrecords;
  numbervar group3cost
  
  //{@Group3cost}
  whileprintingrecords;
  numbervar group3cost := group3cost + {@group4total}
  
  //{@Group4total}
  whileprintingrecords;
  numbervar group4cost
  
  //{@Group4cost}
  whileprintingrecords;
  numbervar group4cost := group4cost + {XVR_projectcostbudget.cost_budget}
  </code></pre>
  
  <p>I'm noticing that simply doing the SUM of XVR_projectcostbudget.cost_budget in SQL is not yielding the same result as the Crystal Report. Any ideas?</p>
  
  <p>Thanks!</p>