down votefavorite 
<https://stackoverflow.com/questions/44998803/django-inner-join-queryset-where-there-is-no-foreign-key-relation-between-two-ta/44998962?noredirect=1#>

Please Help ! I Want to know the inner join Queryset for the below 
mentioned raw oracle Query : -

select PubEv.published_date , PubEv.published_by ,PubEv.publish_by ,
PubC.component,PubC.comp_version,PubC.publish_id from PubEv inner join PubC 
on PubC.publish_id = PubEv.publish_id where PubC.target_branch = 
'polaris_dev' and PubC.component = 'aaa' order by PubEv.published_date desc;

And the models mentioned in the django project are as follows:-

class PubEv(models.Model):
    vob = models.CharField(max_length=20)
    target_branch = models.CharField(max_length=60)
    publish_id = models.IntegerField(primary_key=True)
    target_branch_label = models.CharField(max_length=50, blank=True, null=True)
    main_release = models.CharField(max_length=10, blank=True, null=True)
    published_by = models.CharField(max_length=16)
    published_date = models.DateTimeField()
    publish_ddts = models.CharField(max_length=10)
    unpublished = models.CharField(max_length=1)
    changeset = models.ForeignKey('CcChangesets')

    class Meta:
        managed = False
        db_table = 'publish_events'
class PubC(models.Model):
    publish_id = models.IntegerField(primary_key=True)
    vob = models.CharField(max_length=20)
    target_branch = models.CharField(max_length=60)
    component = models.CharField(max_length=40)
    comp_version = models.CharField(max_length=40)

    class Meta:
        managed = False
        db_table = 'publish_contents'

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c3206253-0f17-4eb7-8df0-6da0bc3129c7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to