Relative Content

Tag Archive for sqlgroup-bysummariadbsubquery

How to SUM and GROUP BY inside a subquery

I’m trying to calculate in a subquery the sum of a column that’s been joined in a one-to-many relationship, grouped by a foreign key so that for every record relating to the same key there’s a subtotal of all of those records.