Opened 5 years ago

Closed 5 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 Mariusz Felisiak, 5 years ago

Component: UncategorizedDatabase layer (models, ORM)
Resolution: invalid
Status: newclosed
Summary: support join tables query over two tables without foreign keySupport join tables query over two tables without foreign key.
Version: 2.2master

Thanks for the report. I'm not completely sure what do you want to achieve but I assumed that you have ManyToManyField between User and Role 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.

Note: See TracTickets for help on using tickets.
Back to Top