#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Posts
    12
    Rep Power
    0
    I have a mysql table that stores student information about if they have applied for an internet connection.

    What I need to do is be able to specify a range of dates and pull how many students were connected between those two dates. I also need it to break down how many connections were made on each day between those dates.

    EX: Jan 1 - Jan 7 234 total connections
    Jan 1 80 connections
    jan 2 4 connections
    jan 3 16 connections
    ....
    Jan 7 23 connections

    1. Is it possible to do this with PHP and MySQL

    2. Hints or help with how to do it would be greatly appreciated.

    Thanks
    FuZZ
  2. #2
  3. Banned (not really)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 1999
    Location
    Brussels, Belgium
    Posts
    14,642
    Rep Power
    4492
    There are some answers in the PHP forum...even though this is more of a MySQL question...

    ---John Holmes...
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Posts
    8
    Rep Power
    0
    I'm not sure if I understood your question, but try the following query:

    select
    count(StudentID)
    from
    yourtable
    group by
    ConnectionDate
    order by
    ConnectionDate

    Hope you understand my dummy-fields
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Posts
    8
    Rep Power
    0
    Sorry!
    You wanted a specific range. I believe you must use the command HAVING. Be warned though this command is better to be avoided (takes a lot of resources).

    select
    count(StudentID)
    from
    yourtable
    group by
    ConnectionDate
    HAVING
    ConnectionDate > $Startdate
    ConnectionDate < $Enddate
    order by
    ConnectionDate

Similar Threads

  1. Replies: 1
    Last Post: January 9th, 2004, 03:48 PM
  2. Database statistics, submissions over last 12 hours.
    By dodgie in forum PHP Development
    Replies: 5
    Last Post: December 22nd, 2001, 11:47 AM
  3. Dates and statistics
    By thefuzzball in forum PHP Development
    Replies: 4
    Last Post: November 15th, 2000, 09:14 PM

IMN logo majestic logo threadwatch logo seochat tools logo