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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:54:58+00:00 2026-05-28T02:54:58+00:00

I have a multiple JOIN in the form of SELECT * FROM column1 LEFT

  • 0

I have a multiple JOIN in the form of

SELECT * FROM column1
  LEFT JOIN column2 USING(id)
  JOIN column3 USING(name)
  JOIN column4 USING(info)
  WHERE column1.id = 44

If changing the LEFT JOIN to JOIN; for obvious reason, the query will return nothing in the absence of column2.id. The main data is column1 and the others are supportive data; thus, I want to retrieve data just if column1.id exists.

My question is: Does the first LEFT JOIN guarantees the query to return column1 values where column1.id exists, regardless of subsequent JOINs (e.g. when column3.name does not exist)? Or I need to change the next (all) JOINs to LEFT JOIN too?

  • 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-28T02:54:58+00:00Added an answer on May 28, 2026 at 2:54 am

    You have a few options as the direct answer to your question is no.

    Change all subsequent joins to LEFT JOINs.

    SELECT * FROM column1
      LEFT JOIN column2 USING(id)
      LEFT JOIN column3 USING(name)
      LEFT JOIN column4 USING(info)
      WHERE column1.id = 44
    

    If possible, re-arrange the query…

    SELECT * FROM column1
      JOIN column3 USING(name)
      JOIN column4 USING(info)
      LEFT JOIN column2 USING(id)
      WHERE column1.id = 44
    

    Or…

    SELECT * FROM column1
      JOIN
      (
           column3
      JOIN column4 USING(info)
      LEFT JOIN column2 USING(id)
      )
        USING(name)
      WHERE column1.id = 44
    

    On a side note, I’d avoid natural joins and the USING syntax. The logic is less transparent, it’s more open to bugs, more open to break later (if you add a field to one of the tables duplicating a field in the USING option), etc, etc.

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

Sidebar

Related Questions

I have multiple selects: <select id=one> <option value=1>one</option> <option value=2>two</option> <option value=3>three</option> </select> <select
I have multiple classes that all derive from a base class, now some of
I have multiple tables post id Name 1 post-name1 2 post-name2 user id username
I am trying to select one item form the items table and join the
I have multiple Django models that reference a model using foreign keys as such:
So lets say I have a dataset based on: SELECT TopicLink.*, Topic.Name AS FromTopicName,
I have a while loop getting info from a MySQL db, outputting info via
I want to represent clubs which have multiple members (each member can also join
I have a situation where I want to associate multiple values from one table
What I have is a form which shows company information and also multiple contact

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.