The sum total of a column

    Date: 03/24/06 (MySQL Communtiy)    Keywords: no keywords

    I thought this would be straight forward but I am having no luck with my query

    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?

    Source: http://community.livejournal.com/mysql/90996.html

« Ordering by numbers(?) || recursive query »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home