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

The Archive Base Latest Questions

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

I wonder if it’s possible to make a query ignore a table if there

  • 0

I wonder if it’s possible to make a query ignore a table if there is no match in that table but shows matches from the other tables?
Let’s say I have three tables and I use a query like this:

SELECT table1.username, table2.age, table3.something_else FROM table1, table2, table3 
WHERE (table1.id = 37)
AND (table2.id = table1.id)
AND (table3.id = table1.id)

So this works if the id exists in all tables but if the id does not exist in one of the tables the query would’nt return any values at all. How would I write the query if I would return the columns where that id does exists?

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

    use a LEFT JOIN

    For instance

    SELECT table1.username, table2.age, table3.something_else
    FROM table1
    LEFT JOIN table2 ON (table2.id = table1.id)
    LEFT JOIN table3 ON (table3.id = table1.id)
    WHERE (table1.id = 37)
    

    When you include additional tables using a comma you are doing an implicit JOIN but it is an inner join.

    Read up on JOINs here

    In the mean time here’s a nice summary image:

    Visual description of join types

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

Sidebar

Related Questions

I wonder, if someone could help me... Is there a LINQ query that will
I wonder if there is a way for me to SCP the file from
I wonder if there is a way to query the XMPP server (passing user
I wonder if it's possible to shorten query depending on some variable value in
I wonder if there is a function that converts rational types to Float (Rational
wonder what's wrong <table id=tblDomainVersion> <tr> <td>Version</td> <td>No of sites</td> </tr> <tr> <td class=clsversion>1.25</td>
I wonder if there are any game engine written in Scala or easily accesible
wonder if someone can help me i know what i want to achive but
I wonder if anyone can help - I want to select a table and
I wonder how it would be possible to implement a positional inverted index in

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.