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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:37:59+00:00 2026-05-22T17:37:59+00:00

Possible Duplicate: SQL left join vs multiple tables on FROM line? SELECT messages.message_title, messages.message_content,

  • 0

Possible Duplicate:
SQL left join vs multiple tables on FROM line?

   SELECT messages.message_title, 
          messages.message_content, 
          messages.message_timestamp, 
          user_message_relations.sender_id
     FROM messages 
LEFT JOIN global_messages ON messages.message_id = global_messages.message_id
LEFT JOIN user_messages ON messages.message_id = user_messages.message_id, user_message_relations
    WHERE user_message_relations.receiver_id = 3

OR

SELECT messages.message_title, 
       messages.message_content, 
       messages.message_timestamp, 
       user_message_relations.sender_id
  FROM messages,  
       global_messages, 
       user_messages, 
       user_message_relations
 WHERE user_message_relations.receiver_id = 3

My main question is, what’s the point of using LEFT OUTER JOIN (or any kind of JOIN) if I can just call the table directly like the second query? Is there a benefit?


I see that the second method is not considered “best practice” … with that in mind, would this following query be correct if I wanted to populate the inbox of a user with the id of 3?

SELECT messages.message_id, 
    messages.message_title, 
    messages.message_content, 
    messages.message_timestamp, 
    user_messages.message_id, 
    user_message_relations.sender_id
FROM user_message_relations 
INNER JOIN user_messages ON user_message_relations.user_message_id = user_messages.user_message_id
INNER JOIN messages ON user_messages.message_id = messages.message_id
WHERE user_message_relations.receiver_id = 3
  • 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-22T17:37:59+00:00Added an answer on May 22, 2026 at 5:37 pm

    As OMG Ponies says, there’s no such thing as “calling tables” directly. In SQL, multiple tables can be be combined in three ways:

    • outer join, where you match rows of the tables but allow for cases where one of the tables doesn’t have a matching row
    • Cartesian product, where every row from the first table is combined with every row of the second table (hence “product”)
    • an inner join, where rows are matched in both tables

    As it happens, your three examples each has one of these, in the order I listed them. None is more “efficient” than the other; they return very different results!

    The confusion comes because there are two different syntaxes for these; your example 2 is using the older SQL89 syntax in which table names are separated by commas, and the combination is a Cartesian product unless something in the WHERE clause says to join them.

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

Sidebar

Related Questions

Possible Duplicate: SQL Server: Can I Comma Delimit Multiple Rows Into One Column? I
Possible Duplicate: Attempted SQL injection attack - what are they trying to do? I
Possible Duplicate: Split string in SQL I have seen a couple of questions related
Possible Duplicate: Internationalization in SSRS We use SQL Server Reporting Services for our web
Possible Duplicate: Why not use tables for layout in HTML? Under what conditions should
Possible Duplicate: How do you send email from a Java app using Gmail? How
Possible Duplicate: SQL query to find Missing sequence numbers I have a table which
Possible Duplicate: SQL: What does =* mean? I am going through some legacy code
Possible Duplicate: SQL: What’s the difference between HAVING and WHERE? i am learning sql
Possible Duplicate: SQL Server Database query help Hi, I have a problem that 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.