File tree Expand file tree Collapse file tree
services/libs/data-access-layer/src/affiliations Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -40,17 +40,11 @@ export async function findWorkExperiencesBulk(
4040 AND "deletedAt" IS NULL
4141 ),
4242 aggs AS (
43- SELECT
44- osa."organizationId",
45- sum(osa."memberCount") AS total_count
46- FROM "organizationSegmentsAgg" osa
47- WHERE osa."organizationId" IN (SELECT "organizationId" FROM relevant_orgs)
48- AND osa."segmentId" IN (
49- SELECT id FROM segments
50- WHERE "grandparentId" IS NOT NULL
51- AND "parentId" IS NOT NULL
52- )
53- GROUP BY osa."organizationId"
43+ SELECT "organizationId", COUNT(DISTINCT "memberId") AS total_count
44+ FROM "memberOrganizations"
45+ WHERE "organizationId" IN (SELECT "organizationId" FROM relevant_orgs)
46+ AND "deletedAt" IS NULL
47+ GROUP BY "organizationId"
5448 )
5549 SELECT
5650 mo.id,
You can’t perform that action at this time.
0 commit comments