Does Django support JOIN?

余生长醉 提交于 2021-01-27 13:03:46

问题


Does Django ORM support join like INNER JOIN, LEFT JOIN, RIGHT JOIN AND OUTER JOIN?

I read the document, and did not found one.

For example how can I do this?

SELECT * 
FROM auth_user_groups
JOIN test_groups ON auth_user_groups.group_id=test_groups.group_id
WHERE test_id='1'
AND user_id='2'
LIMIT 1

test_group is a Many to many table, without any model class.


回答1:


No. Use relational fields and appropriately-crafted queries to perform joins instead.



来源:https://stackoverflow.com/questions/6001744/does-django-support-join

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!