List:General Discussion« Previous MessageNext Message »
From:Alexandra Date:October 14 2005 8:58am
Subject:Counting total results from a table
View as plain text  
Hello,

I am trying to build a sql statement for MySQL 4.0.x which does count 
the accumulated total entries in a table per day since a specified start 
date.

For example:
Day 1 = 10
Day 2 = 12
Day 3 = 9

The statement I am using gives  back the entries per day, starting each 
day with 0.
For example:
Day1 = 10
Day2 = 2
Day3 =0 (-3)

code:
    SELECT    
        DATE_FORMAT( timestamp, '%Y%m%d') AS mydate,
        count(*) AS ct,
        ID
    FROM    
        $DB.$T4
    WHERE
            (timestamp >= '$date_start'
        AND
            timestamp <=  '".$date_end."235959')
        AND
            confirmed = '1'
    GROUP BY
        mydate

Has anybody an idea how to recraft the statement to get the accumulated 
entries per day?

Thank you for any help,

Alexandra
Thread
Counting total results from a tableAlexandra14 Oct
  • Re: Counting total results from a tableArno Coetzee14 Oct