title: How convert sql join query into django queryset
body: <p>I am trying to write django sql query on two tables i.e. table1, table2 and display query data in table3. Could someone show how to convert the following SQL join query to the Django queryset.</p>
  <pre><code>Sql query
  
  INSERT INTO table3(project_name,task_name,set_status,date,created_by)
  SELECT table1.projects_name, table2.task_name,'pending' AS set_status, table1.created_date, table2.created_by_id
  FROM table1
  RIGHT JOIN table2 ON (table1.id = table2.projects_name_id AND table1.created_by_id = table2.created_by_id) 
  
  Model
  
  class Table1(models.Model):
      projects_name = models.CharField(max_length=100)
      created_date  = models.DateTimeField(auto_now_add=False, blank=True)
      created_by    = models.ForeignKey(User, related_name=&quot;projectcreatby&quot;, on_delete=models.CASCADE)
  
  class Table2(models.Model):
      projects_name = models.ForeignKey(Projects, related_name=&quot;projects&quot;, on_delete=models.CASCADE)
      task_name     = models.CharField(max_length=100)
      created_by    = models.ForeignKey(User, related_name=&quot;taskcreateby&quot;, on_delete=models.CASCADE)
  
  class Table3(models.Model):
      project_name = models.CharField(max_length=100)
      task_name    = models.CharField(max_length=100)
      set_status   = models.CharField(max_length=20, blank=True)
      date         = models.DateTimeField(auto_now_add=False, blank=True)
      created_by   = models.CharField(max_length=100)
  </code></pre>