SELECT SUM(Amount) AS total FROM office WHERE datepaid BETWEEN '$range1' AND '$range2'
I have several rows of data and one column that I want to create a summary for by month. For this I am looping 12 times and storing the data in an array.
However, my result is incorrect. If I go line by line and total up the year I get a greater number. Is there something obviously wrong in my query?