Skip to content

Commit

Permalink
reduce aliases in subqueries
Browse files Browse the repository at this point in the history
  • Loading branch information
alxndrsn committed Feb 7, 2025
1 parent 245958e commit 835d5b7
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/model/query/analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ const getDatasets = () => ({ all }) => all(sql`
, COALESCE(creates.create_api_recent , 0) AS num_entity_create_api_recent
, COALESCE(bulk_creates.total , 0) AS num_entity_create_bulk_total
, COALESCE(bulk_creates.recent , 0) AS num_entity_create_bulk_recent
FROM datasets ds
FROM datasets AS ds
LEFT JOIN (
SELECT "datasetId"
, COUNT(id) AS num_entities_total
Expand All @@ -462,12 +462,12 @@ const getDatasets = () => ({ all }) => all(sql`
GROUP BY dfd."datasetId"
) AS fd ON fd."datasetId" = ds.id
LEFT JOIN (
SELECT fa."datasetId"
, COUNT(fa."formId") AS num_followup_forms
FROM form_attachments AS fa
JOIN forms AS f ON f.id = fa."formId"
SELECT "datasetId"
, COUNT("formId") AS num_followup_forms
FROM form_attachments
JOIN forms AS f ON f.id = "formId"
WHERE f."currentDefId" IS NOT NULL
GROUP BY fa."datasetId"
GROUP BY "datasetId"
) AS fa ON fa."datasetId" = ds.id
LEFT JOIN (
SELECT COUNT(a.details->'submissionId') AS total
Expand Down

0 comments on commit 835d5b7

Please sign in to comment.