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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T09:25:37+00:00 2026-06-01T09:25:37+00:00

I have a problem with a sql-statement. My DB is MySQL 5.1. I have

  • 0

I have a problem with a sql-statement.
My DB is MySQL 5.1.

I have 2 tables:

day_table 
date(pk)    note    ...
------- -----   ---
2012-03-29  foo ...
2012-03-30  bar ...
2012-03-31  foobar  ...

other_table
id  fk_date     key     value
--  -------     ---     -----
1   2012-03-29  foo     5
2   2012-03-30  bar     9
3   2012-03-30  foo     4
4   2012-03-31  bar     6
5   2012-03-31  foo     1

So I need a query something like this:

SELECT o.value, d.date FROM other_table o join day_table d on (...) where key = "bar" group by d.date;

And I need a result like this:

result_table
date(pk)    value 
------- -----
2012-03-29  0 (or null) <---- THIS IS IMPORTANT!!!
2012-03-30  9       
2012-03-31  6

I know the problem is the join, but I need to get each date in day_table.

Is this possible with (My)SQL?

Best Regards

  • 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-01T09:25:38+00:00Added an answer on June 1, 2026 at 9:25 am

    use left join instead of inner join:

    SELECT o.value, d.date FROM day_table o left join other_table d on o.date=d.date and key = "bar" group by d.date;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a complex sorting problem with my SQL statement. I have a table
I have a problem with the SQL statement detailed below. The query returns the
I have an big problem with an SQL Statement in Oracle. I want to
I have a problem creating the following SQL Statement using LINQ & C# select
i have a problem with sql query. I need to get list of users.
I have a problem with an SQL query. SELECT SUM(table_colum) AS value, SUM(value *
I have problem with Oracle 9.2 and JMS. I created PL/SQL routine to send
I have an interesting SQL problem that I need help with. Here is the
I have a complex SQL problem in MS SQL Server, and in drawing on
I have a problem extracting the year out of a mysql timestamp field. I

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.