Django Equivalent For Sql Query Using Inner Join -clause
I would like to know the django equivalent for the SQL-query that uses the INNER JOIN -clause. I have two models that are linked with ForeignKey. class Item(models.Model): item
Solution 1:
You can use filter and only to get desired result.
Try:
Request.objects.filter(item__item_is_locked=False).only('item_owner', 'message_body')
Post a Comment for "Django Equivalent For Sql Query Using Inner Join -clause"