class TA(models.Model):
col1 = models.CharField()
col2 = models.CharField()
x_number = models.IntegerField()
class TB(models.Model):
col1 = models.CharField()
col2 = models.CharField()
ta_id= models.ForeignKey(TA)
x_number = models.IntegerField()
The query I seek is in this form.
select *
from TA
left join TB
on TA.id = TB.ta_id
and TA.x_number = TB.x_number
where TA.deleted = False
and TB.deleted = False
- TA.deleted and TB.deleted are Boolean Fields.
- TA.id are primary key.
How do I create a query like this in Django?