INNER JOIN keeps only rows that match on both sides; LEFT JOIN keeps every left row and fills the missing right side with NULL. WHERE filters rows before grouping, HAVING filters after aggregation — which is exactly why SUM(...) belongs in HAVING, not WHERE.
With GROUP BY, the SELECT list may only contain grouped columns and aggregates — anything else is the classic “not in GROUP BY” error.