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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:53:49+00:00 2026-05-26T18:53:49+00:00

OKay, I will try to make this make sense lol. Basically I have 4

  • 0

OKay, I will try to make this make sense lol. Basically I have 4 different tables I am trying to join instead of doing a few separate SQL statements, as the MYSQL engine should be able to optimize it better than I could.

Basically I have these 4 tables:

projects (key:id)
project_users (key:project_id , user_id)
users (key:id)
tasks (key:project_id)

This is my query:

     SELECT projects.*, users.*, tasks.*,
     FROM 
     projects JOIN ( project_users JOIN 
                     users ON 
                     project_users.user = users.id ) 
        ON projects.id = project_users.project_id
        JOIN ( tasks )
               ON projects.id = tasks.project_id 
      WHERE projects.company = 2 ORDER BY projects.id

Basically I am trying to get a list of projects, users in that project, and tasks in that project for a certain company.

THE ISSUE – If there is not a task in this project, it doesnt return that project. Which I still need that project, just with 0 tasks for that project.

I am new to JOIN statements, so if there is some improving I can do, PLEASE let me know!

THANK YOU FOR YOUR TIME AND HELP!!!!!

  • 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-26T18:53:50+00:00Added an answer on May 26, 2026 at 6:53 pm

    All you need to do is add left outer before the join that joins the tasks. This will get you projects even though there are no tasks.

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

Sidebar

Related Questions

Okay, this scenario is a little complicated, but I will try to explain it
Okay so I'm trying to make a little gag program that will run away
Okay, I'll try to make this as straight forward as possible. I'm using VB.Net
Okay to keep it short: I have some different websites with tables containing information
Okay, this will be a bit hard to explain, but I'll try my best.
Okay, so this one may be difficult but I will do my best to
Okay, I have a try..catch such that : Try Dim dr As OleDbDataReader =
Okay, I'm trying to create a simple app that will draw a shape (I'm
Okay we have a single - sign - on and the user will likely
Okay I'm using jQuery and currently getting max value of scrollbar doing this: var

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.