SELECT sector.sector, count(*)
FROM reports, organization, sector
WHERE reports.org_id = organization.id
AND organization.id = sector.org_id
GROUP BY sector.sector;
老实说,我什至不确定从哪里开始在 sqlalchemy 中表达这个 GROUP BY 和 JOIN。
SELECT sector.sector, count(*)
FROM reports, organization, sector
WHERE reports.org_id = organization.id
AND organization.id = sector.org_id
GROUP BY sector.sector;
老实说,我什至不确定从哪里开始在 sqlalchemy 中表达这个 GROUP BY 和 JOIN。