SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict
    Join Date
    Mar 2011
    Location
    Manchester, UK
    Posts
    227
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Sum Total Per Day

    Hi Guys,

    I have a database which has new records added every day, on each record there is a time stamp called TimeStamp and has info like this:

    2013-11-11 08:00:53

    I want a query which will count how many records there are for each day, so for example:

    2013-11-11 = 102 records
    2013-11-10 = 211 records
    2013-11-09 = 163 records
    etc...

    I'm not sure how id do this but any help would be great.

    Thank you...!
    You're Help Does Not Go Unnoticed, I have So Far Donated 25 GBP
    To Cancer Research UK As A Thank You To All The SitePoint
    Members That Have Helped Me In The PHP Forum Thank You!

  2. #2
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,509
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    Something with DATE(), COUNT() and GROUP BY

  3. #3
    SitePoint Addict
    Join Date
    Mar 2011
    Location
    Manchester, UK
    Posts
    227
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Done it thanks

    Code:
    SELECT COUNT( * ) , DATE_FORMAT(  `TimeStamp` ,  "%Y-%m-%d" ) AS Total_Leads
    FROM data
    GROUP BY Total_Leads
    You're Help Does Not Go Unnoticed, I have So Far Donated 25 GBP
    To Cancer Research UK As A Thank You To All The SitePoint
    Members That Have Helped Me In The PHP Forum Thank You!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •