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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T09:50:54+00:00 2026-05-12T09:50:54+00:00

The following two queries are returning different results, to my surprise: SELECT * FROM

  • 0

The following two queries are returning different results, to my surprise:

SELECT *
  FROM foo
       JOIN bar
         ON bar.id=foo.bar_id

       JOIN baz
         ON baz.id=foo.baz_id

       LEFT JOIN zig
         ON zig.foo_id=foo.id;

and:

SELECT *
  FROM foo
       LEFT JOIN zig
         ON zig.foo_id=foo.id

       JOIN bar
         ON bar.id=foo.bar_id

       JOIN baz
         ON baz.id=foo.baz_id;

I’m imagining that it shouldn’t matter when you LEFT JOIN on zig, since I’m not using zig‘s columns when joining the bar and baz. However, it appears that in the latter, the JOIN-ing of bar and baz swallows up the rows where zig had null values… why is that?

  • 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-12T09:50:55+00:00Added an answer on May 12, 2026 at 9:50 am

    This works fine. I was wrong.

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

Sidebar

Related Questions

I have the following two queries. SELECT account_name,SUM(amount) AS AMOUNT1 FROM entries LEFT JOIN
Consider the following two queries: select a.*, c.* from account a join customer c
I have the following two queries: select count(*) from segmentation_cycle_recipients scr , segmentation_instance si
Can anyone please explain to me why the following two queries yield different results?
I have two queries, as following: SELECT SQL_CALC_FOUND_ROWS Id, Name FROM my_table WHERE Name
Which of the two following queries might be faster? $cposts = mysql_query(SELECT id FROM
The following two queries each give the same result: SELECT column FROM table GROUP
Will the following two queries be executed in the same way? SELECT COUNT(*) from
I have the following two queries: $query = $this->doctrine->em->createQuery(select u from ORM\Dynasties2\Characters u WHERE
I'm trying to UNION the results of two queries. But I'm getting the following

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.