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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T00:06:42+00:00 2026-05-24T00:06:42+00:00

This is probably really easy, but I am having trouble with it. I asked

  • 0

This is probably really easy, but I am having trouble with it. I asked a question earlier (MySql Query help) about a query and the answer was to create another table and join it with my current query. So I am creating a temporary table and joining it with my query but am getting the same results.

Overview:
I have a dates tables with the dates for the last 30 days and a value of 0 for every entry

+------+------------+
| Zero | Date       |
+------+------------+
|    0 | 2011-07-27 |
|    0 | 2011-07-26 |
|    0 | 2011-07-25 |
|    0 | 2011-07-24 |
|    0 | 2011-07-23 |
|    0 | 2011-07-22 |
...etc

And I am trying to join this table with a query I do another table that gets these results:

+-------------------+-----------+
| Past-Month-Builds | Month-Day |
+-------------------+-----------+
|                53 | 6-27      |
|               103 | 6-28      |
|                91 | 6-29      |
|                70 | 6-30      |
|                76 | 7-1       |
|                 8 | 7-2       |
|                77 | 7-5       |
|               111 | 7-6       |
|                67 | 7-7       |
|                70 | 7-8       |
|                 2 | 7-9       |
|                 3 | 7-10      |
|                87 | 7-11      |
|                53 | 7-12      |
|                49 | 7-13      |
|                84 | 7-14      |
|               126 | 7-15      |
|                 3 | 7-16      |
|                 8 | 7-17      |
|                98 | 7-18      |
|               114 | 7-19      |
|               841 | 7-20      |
|               206 | 7-21      |
|               738 | 7-22      |
|                 2 | 7-23      |
|                65 | 7-25      |
|                39 | 7-26      |
|                21 | 7-27      |
+-------------------+-----------+

Notice that there are missing days, I would like the Past-Month-Builds Col to display 0 when there weren’t any builds on that day.

Here is the query I am trying to use:

SELECT
    COUNT(id) AS 'Past-Month-Builds',
    CONCAT(MONTH(builds.submittime), '-', DAY(builds.submittime)) as 'Month-Day'
FROM builds
    RIGHT JOIN dates ON DATE(builds.submittime) = dates.Date
WHERE DATE(builds.submittime) >= DATE_SUB(CURDATE(), INTERVAL 30 day)
GROUP BY MONTH(submittime), DAY(submittime);

Kinda lost, any help would be great
Thanks.

  • 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-24T00:06:42+00:00Added an answer on May 24, 2026 at 12:06 am

    Change the query so dates is the primary table and use a left outer join to the builds table.

    Also, move any criteria related to the builds table from the WHERE clause to the ON clause since that’s the optional table.

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

Sidebar

Related Questions

This is probably a really dumb question, but I'm finding conflicting information. I have
This probably sounds like a really dumb question, but here goes....Web Services, what the
This has probably been asked, but I can't find it... I want to link
I know this has probably been asked a lot on here, but I am
This is probably really simple, I know you can change css properties with javascript
Probably this is the lamest question >< I am developing an ASP.net web app
I know this is probably subjective but I read this optimization page from Google
I have started a bounty for this question ...because I really want the community's
I am looking for an elegant way of returning back references using regular expressions
I am making a component based system (each object delegates all functionality to a

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.