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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:12:14+00:00 2026-05-28T07:12:14+00:00

Is it possible to LEFT JOIN one QuerySet to another? I know it’s possible

  • 0

Is it possible to LEFT JOIN one QuerySet to another? I know it’s possible to INNER JOIN two, as follows:

QuerySet1.filter(foreign_key__in=QuerySet2)

Is there any way to achieve a similar effect but with a LEFT rather than INNER JOIN?

  • 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-28T07:12:15+00:00Added an answer on May 28, 2026 at 7:12 am

    That’s not an inner join. It’s a sub-select query, which gives you all the results of queryset1 which have their FK in queryset 2 – but it’s not a join, as at the end you only have the elements from the Q1 table, not those in q2.

    The only way to do a real join – ie get elements from both tables in one query – is to use select_related. What happens here is that the foreign key relationship in table1 are prepopulated with the result of the join. So, by default this is a left join, not an inner one, as you get the elements of table1 whether or not there are any matches in table2.

    You could combine the two techniques to simulate an inner join: QuerySet1.select_related().filter(foreign_key__in=QuerySet2) but I’m not sure if the query creator is clever enough to combine those into a single join, or whether it will do a join + a subselect.

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

Sidebar

Related Questions

Is is possible to accomplish the equivalent of a LEFT JOIN with subselect where
Possible Duplicate: What's the difference between NOT EXISTS vs. NOT IN vs. LEFT JOIN
Is it possible to make a left join, but order by a column in
Is it possible to scroll down the left and right parts of a vertically
is it possible to get the mouse direction (Left, Right, Up, Down) based on
is it possible to change the left position of a div after dropping it?
Is it possible to handle such events as: Ctrl + mouse left button click;
Is it possible to get the X and Y (Left and Top) coordinates of
Im trying to shift my array left as efficiently as possible. Im using pointers
Is it possible to retrieve the geometric position (i.e. top/left offsets from either the

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.