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

  • Home
  • SEARCH
  • 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 8286971
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T11:54:56+00:00 2026-06-08T11:54:56+00:00

How can I fill gaps between rows? Im using table calendar but my query

  • 0

How can I fill gaps between rows? Im using table calendar but my query does not seem to be correct. The result is not showing the gaps..

SELECT calendar.datefield, t2.*
    FROM store_relation t1,store t3, store_product t2
            RIGHT JOIN calendar ON (DATE(t2.created) = calendar.datefield)
            WHERE (calendar.datefield BETWEEN ('2012-07-15') and ('2012-07-20'))
    AND t1.id_store_a = 1
    AND t1.id_store_b = t2.id_store
    AND t3.id = t2.id_store
    AND t2.id_product = 11
    ORDER By t2.price

Result:

datefield   |   id_product   |   id_store   |   created
2012-07-15      1                1              2012-07-15
2012-07-18      1                1              2012-07-18
2012-07-20      1                1              2012-07-20
2012-07-20      1                1              2012-07-20

I was waiting for the result

datefield   |   id_product   |   id_store   |   created
2012-07-15      1                1              2012-07-15
2012-07-16      null             null           null
2012-07-17      null             null           null
2012-07-18      1                1              2012-07-18
2012-07-19      null             null           null
2012-07-20      1                1              2012-07-20
2012-07-20      1                1              2012-07-20
  • 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-06-08T11:54:58+00:00Added an answer on June 8, 2026 at 11:54 am

    When you have a LEFT/RIGHT JOIN and you are filtering on tables that are optionally included, the WHERE clause will leave those records out. You need to include a condition that allows for the left part of the RIGHT JOIN being missing:

    WHERE (calendar.datefield BETWEEN ('2012-07-15') and ('2012-07-20'))
    AND
    (
       (t1.id_store_a = 1
       AND t1.id_store_b = t2.id_store
       AND t3.id = t2.id_store
       AND t2.id_product = 11)
       OR
       (t2.id_product is NULL)
    )
    

    For example, if you look at your expected output, the value of id_product is null, but you are filtering for t2.id_product = 11. So the null records are never going to match 11, and that’s why they are being left out.

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

Sidebar

Related Questions

Is there an image processing algorithm that can fill these gaps within an image?
I have a table with a form below it. You can fill out the
i can fill my listdictinary but, if running error returns to me in foreach
Is there a straightforward query to fill in the gaps in a column with
I have 3 UITexfield, the user can fill in the first two, but the
I have this scenario, can anybody fill the gaps for me? Its like this:
So I can fill out the form on the desktop size but when I
I have a from where you can fill in any combination of your home,
I am creating a HTML layout where user can fill the data and save
In Short: I have a PDF that customers can fill out. When they press

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.