title: Doing Math with SQL entries
body: <p>so I am trying to use MySQL to look at the values of our database, and spit out the sum of the values in a column between 2 date ranges. Currently I have gotten it to at least select the correct range of dates using the code:</p>
  
  <pre><code>SELECT fuelDate, SUM(gallons)  
  FROM fuel566243
  WHERE fuelDate BETWEEN '2019-01-04' AND '2019-01-24'
  GROUP BY fuelDate 
  ORDER BY fuelDate
  </code></pre>
  
  <p>The issue with this code, is in the SUM column that gets generated, it just displays all the values of the gallons column, but doesn't add them up. Is there a way to do this in SQL and output a result? Or is it easier to just use a foreach loop to cycle through the array and add the values using PHP?</p>
  
  <p>When I run the code above, it gives me this output. How do I then get the sum of the gallons column shown below? Is there a way to do that in SQL? Or would I need to use a loop to add the values using PHP?</p>
  
  <pre><code>| fuelDate | Gallons | | 
  | 2019-01-04 | 53.8885 | |
  | 2019-01-15 | 198.1700 | | 
  | 2019-01-17 | 167.2750 | | 
  | 2019-01-23 | 176.5620 | | 
  | 2019-01-24 | 181.0240 | |
  
  
  </code></pre>