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 6186105
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T01:49:44+00:00 2026-05-24T01:49:44+00:00

I have a table with that contains information that I would like to show

  • 0

I have a table with that contains information that I would like to show stats for each day between a particular range of dates. The table consists of the following:

CREATE TABLE IF NOT EXISTS `questions` (
  `qid` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `question_created_date` datetime NOT NULL,
  `question_response_date` datetime NOT NULL,
)

I am able to use the following query to displays the amount of questions created on each day between $start_date and $end_date.

SELECT COUNT(*) as q_count, DATE(question_created_date) as date FROM questions where question_created_date between "$start_date" and "$end_date" GROUP BY date ORDER BY date asc

I would also like for it to list the amount of topics that were responded to on the same days. For exmaple if on 7/5/11 there were 10 new questions and 5 questions responded to and on 7/6/11 there were 5 new questions and 11 questions responded to, I want to be able to show:

Date|New|Responded

7/5/11 10 05
7/6/11 05 11

Can this be done via mysql?

I know I can perform the query listed above and then for each day perform another query to get the amount of questions responded to for that day, but I was wondering if there was an easier and more efficient way to do this in one query.

Thanks in advance.

  • 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-24T01:49:45+00:00Added an answer on May 24, 2026 at 1:49 am

    The two dates aren’t related to each other, except that logically, the response date could only ever be greater than the created date. Grouping on one date will destroy any information you could extract from the other date, so in other words – you’ll need two queries.

    The fields returned would be the same – a count and a date field, so you could issue this is as a single query call, but it’d have to be done as a union query:

    SELECT 'created' as src, count(*) as cnt, DATE(question_created_date) as created ...
    
    UNION
    
    SELECT 'answered' as src, count(*) as cnt, etc...
    

    The virtual ‘src’ column will tell you which internal query produced the result, and the union syntax lets you issue this all as a single query. But within MySQL, it’d still be treated as two completely separate queries, whose results just happen be returned all at once.

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

Sidebar

Related Questions

I have a table that contains information for 4 electrical generators. I would like
I have a table (user) that contains user information. I have another table (userview)
I have two tables: a schedule table that contains information about how an employee
I have a jsp that contains a table with some information from db. I
I have a table in Oracle 10g that contains some information as follows: SQL>
Suppose that I have a database table that contains information on cities across the
I have a table that contains the following information: Conf_Start_Time Part_Start_Time Part_End_Time A record
I have a table that contains file paths, like so: -------------------- |Files | --------------------
I have a table that contains three pieces of patient information. Diagnosis_ID Patient_ID Diagnosis_Code
I have a table that contains multiple dropdown menus for a list of profile

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.