Django ORM 多个 JOIN

问题描述 投票:0回答:0

我有这个 SQL 查询,需要在 django orm 中执行

select count(*), tabel_d.name
from tabel_a 
join tabel_ on tabel_b.id = tabel_a.b_id 
join tabel_c on tabel_c.b_id = tabel_b.id 
join tabel_d on tabel_d.id = tabel_c.d_id 
group by tabel_d.id

如何做到这一点?

sql django django-orm
© www.soinside.com 2019 - 2024. All rights reserved.