Selecting non-aggregate column on 3 table inner join
This can be solved by aggregating first and joining to the result of the aggregation:
SELECT c.name as campaign_name,
       o.name as organization_name
       d.total_amount
FROM (
  select &quot;campaignId&quot;, sum(amount) as total_amount
  from donations
  group by &quot;campaignId&quot;
) d   
  JOIN campaigns c ON c.id = d.&quot;campaignId&quot;
  JOIN organisations o ON o.id = c.&quot;organisationId&quot;
;