tb1.objects.extra(select={"tb2_name": "app_tb2.name"},where=["app_tb1.name= app_tb2.name"], tables=["app_tb2"]).values("name", "tb2_name")
On Sat, Dec 27, 2008 at 7:16 AM, Shuge Lee <shuge....@gmail.com> wrote: > > class tb1( models.Model ): > name = models.CharField(max_length=32) > tb2 = models.ForeignKey(Category) > > class tb2( models.Model ): > name = models.CharField(max_length=64) > > Do I have to use Manager when do cross-table querying such > SELECT > tb1.name, > tb2.name as tb2_name > FROM > tb1 INNER JOIN tb2 > WHERE > tb1.tb2_id = tb2.id > ? > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---