Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1010255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T09:03:15+00:00 2026-05-16T09:03:15+00:00

In my questions table, each post is timestamped (MM-DD-YYYY). Each individual post has a

  • 0

In my questions table, each post is timestamped (MM-DD-YYYY). Each individual post has a QuestionID, and a response has both a QuestionID and ResponseID. I want to run a php script that will grab all questions (all posts where ResponseID = null) and display how many questions per day.

I’d like it to be avg questions per day since June 1, 2010.

Your help is much appreciated. Thank you!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T09:03:16+00:00Added an answer on May 16, 2026 at 9:03 am

    This gets each day, and the number of questions:

    select q.myTimestamp, count(*) 
    from questionsTable q 
    where q.myTimeStamp >= '6/1/2010'
    and q.ResponseID IS NULL
    group by myTimestamp
    

    To get the average you need both the count of days, and sum of number of questions… I would probably do this with 2 queries to MySQL and calculate in PHP.

    $query1 = "select count(*) as totalCount from questionsTable where myTimestamp >= '6/1/2010' and ResponseID IS NULL";
    $query2 = "select count(*) as totalDays from (select distinct myTimestamp from questionsTable where myTimestamp >= '6/1/2010' and ResponseID IS NULL) a";
    
    $res1 = mysql_query($query1);
    $res2 = mysql_query($query2);
    
    $row1 = mysql_fetch_array($res1);
    $row2 = mysql_fetch_array($res2);
    
    $avgPostCount = ($row1['totalCount'] / $row2['totalDays']);
    

    not optimal, but should work..

    I made an assumption, that you wouldn’t want to count days where there were no questions.. otherwise it could be simplified to one query using a mysql function to get the number of days since 6/1/2010.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm coding a quiz and record individual answers in a SQLite-Database. My table has
(Newbie DBUnit question Alert!) It appears that DBUnit for each table 'deletes all the
Requirements : I have a table of several thousand questions. Users can view these
I have a MS access database. In that, one table consists of questions and
I have two questions regarding to html table layout. First I will provide some
Ok, I have an app as described in this post: https://stackoverflow.com/questions/1623105/good-database-structure-for-a-new-web-app I've prepared a
I have an HTML Table with each row: <table> <tr><td><a href='#' id='1' class='delete'>delete</a></td></tr> <tr><td><a
I have a table with 3 rows, each with an ASP.NET panel with a
Ok so I'm building a site where people can post news, comments, questions, etc.
Ok, I have a database with with a table for storing classified posts, each

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.