Opened 6 years ago
Closed 6 years ago
#30574 closed New feature (invalid)
Support join tables query over two tables without foreign key.
Reported by: | wu kt | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | dev |
Severity: | Normal | Keywords: | orm |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
support sql like
SELECT * FROM ROLE INNER JOIN user_role ON ROLE . ID = user_role.role_id
or
SELECT * FROM role r, user_role ur WHERE r.id = ur.role_id
thanks.
Change History (1)
comment:1 by , 6 years ago
Component: | Uncategorized → Database layer (models, ORM) |
---|---|
Resolution: | → invalid |
Status: | new → closed |
Summary: | support join tables query over two tables without foreign key → Support join tables query over two tables without foreign key. |
Version: | 2.2 → master |
Note:
See TracTickets
for help on using tickets.
Thanks for the report. I'm not completely sure what do you want to achieve but I assumed that you have
ManyToManyField
betweenUser
andRole
and you want to select all roles used by users, for that you can use e.g.Role.objects.values(...other columns..., 'user')
.Please use one of support channels.