Django是否支持JOIN? [英] Does Django support JOIN?
本文介绍了Django是否支持JOIN?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Django ORM是否支持像INNER JOIN,LEFT JOIN,RIGHT JOIN和OUTER JOIN之类的联接?
Does Django ORM support join like INNER JOIN, LEFT JOIN, RIGHT JOIN AND OUTER JOIN?
我阅读了文档,但没有找到.
I read the document, and did not found one.
例如,我该怎么做?
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是一个多对多表,没有任何模型类.
test_group is a Many to many table, without any model class.
推荐答案
No. Use relational fields and appropriately-crafted queries to perform joins instead.
这篇关于Django是否支持JOIN?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文