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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T02:49:27+00:00 2026-05-31T02:49:27+00:00

How can i join multiple tables not depending on LEFT or RIGHT join example:

  • 0

How can i join multiple tables not depending on LEFT or RIGHT join

example:

t1 
        id | date
       -----------
       NULL  NULL

t2 
        id | value
       ------------
        1  |  bla

SELECT date,value 
FROM t2 LEFT JOIN t1 
    ON t1.id = t2.id where t2.id = 1

— select is ok

with right join same query return null values …

  • 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-31T02:49:28+00:00Added an answer on May 31, 2026 at 2:49 am
    SELECT `date`, `value` FROM t2 FULL OUTER JOIN t1 ON t1.id = t2.id
    

    Edit: That will return all records, even if there is no match on those joining fields. Sorry, that will give you syntax error. See my edit down below.

    If you only want matches, use inner join:

    SELECT `date`, `value` FROM t2 INNER JOIN t1 ON t1.id = t2.id
    

    Edit: There is no FULL OUTER JOIN in MySQL. You will have to simulate it with UNION and combine a LEFT and RIGHT JOIN:

    SELECT `date`, `value` FROM t2 LEFT JOIN t1 ON t1.id = t2.id
    UNION
    SELECT `date`, `value` FROM t2 RIGHT JOIN t1 ON t1.id = t2.id
    

    This will also return your NULL values, but they will not match, as NULL != NULL

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

Sidebar

Related Questions

Possible Duplicate: SQL left join vs multiple tables on FROM line? SELECT messages.message_title, messages.message_content,
I am LEFT JOINing multiple tables as such: SELECT * FROM table1 LEFT JOIN
I'm trying to build a HQL that can left join values from a collection,
I'm working on a query where I pull data from multiple tables using left
I know you can combine multiple table-selects using a Join statement but is there
Can i join two tables using LINQ for NHibernate like I can do in
As per https://stackoverflow.com/questions/3264227/relations-with-multiple-keys-in-doctrine-1-2 , I have two tables which (as I can't get it
These are my 2 tables: CREATE TABLE `documents` ( `Document_ID` int(10) NOT NULL auto_increment,
Due to a need to join multiple tables in a single query, I am
When LEFT JOINing tables in a SQL query, sometimes I need to reference multiple

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.